Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.x #1

Open
wants to merge 58 commits into
base: 1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
26cacb2
port cookbook to centos.
Jun 16, 2013
095ec4e
straighten up formatting
Jun 17, 2013
9adde67
change daemon module list to use parameter.
Jun 17, 2013
48f7d53
add missing attributes to host template
Jun 17, 2013
4a4203d
allow no content for timeperiods.
Jun 17, 2013
a4276de
add example roles and data bags.
Jun 17, 2013
4c3bba3
add shinken mongodb recipe
Jun 17, 2013
43a904c
add a resource.cfg file
Jun 17, 2013
eeb8d5a
create htpasswd file from users and shinken_contacts
Jun 17, 2013
e6ec5cc
populate the host template before the hosts.
Jun 18, 2013
0a8e21d
use the hostname for the shinken_host name, and set the fqdn as an al…
Jun 18, 2013
e21ef05
specify the command line for the check from a service.
Jun 18, 2013
10af22d
add contactgroup lwrp.
Jun 18, 2013
cd821d9
create a hostgroup for each role in chef.
Jun 18, 2013
349f3b5
set all files to be mode 00644
Jun 18, 2013
1a69fb1
add missing host parameters.
Jun 18, 2013
a0180a1
add lwrp for escalations in shinken, both for hosts and services.
Jun 18, 2013
2ba2a98
add the poller_tag parameter to hosts.
Jun 18, 2013
f98022d
search shinken_contacts databag for non-user contacts.
Jun 18, 2013
6e01818
dd service_dependencies attribute to services.
Jun 18, 2013
c4c9d03
sort service_templates and services to prevent unneeded restarts.
Jun 18, 2013
3726fc5
add attribute for log file directory
Jun 18, 2013
03d0892
add escalation files
Jun 18, 2013
f0b658f
continue chef run if arbiter doesn't start.
Jun 18, 2013
2c4cef8
modules are already a hash
Jun 18, 2013
6c190db
add missing parameters to templates
Jun 18, 2013
b42d471
allow role to override ipaddress for daemons.
Jun 18, 2013
8745595
module config moved to data bag.
Jun 18, 2013
8885303
include base recipe for poller-only nodes.
Jun 18, 2013
2345e69
setup default variables for broker and poller
Jun 18, 2013
5dcd908
add shinken init script for centos
Jun 18, 2013
abd1513
setup pnp4nagios
Jun 18, 2013
7c906b7
remove extra white space.
Jun 18, 2013
8ed4a37
setup thruk
Jun 18, 2013
c3bb158
use host template, not service
Jun 18, 2013
df0d466
include xmppsend script for sending jabber notifications
Jun 18, 2013
e5f8b46
just use the templates specficied by the service.
Jun 18, 2013
8b2225f
by default, use a per-os template for hosts
Jun 18, 2013
ef92001
setup user using nagios attributes.
Jun 18, 2013
2b6b2aa
add example user.
Jun 18, 2013
8ebce2c
add recipe for server-side plugins
Jun 18, 2013
49776c6
add more dependencies
Jun 18, 2013
e8ce626
move thruk to separate cookbook.
Jun 19, 2013
49df2c7
add python-ldap package
Jun 19, 2013
1060b68
move thruk to separate cookbook
Jun 19, 2013
b0ddf19
fixes for debian
Jun 19, 2013
b06fa48
add packs directory
Jun 19, 2013
93946b2
check for nagios attribute
Jun 19, 2013
98da0cc
move thruk to separate cookbook
Jun 19, 2013
543f482
chenge service hostgroup difinition to array
cyberflow Oct 8, 2013
7d2db0c
Merge pull request #1 from cyberflow/1.x
Oct 10, 2013
79d2b09
fix logic for removing users
Oct 10, 2013
b542df0
add automatic role for virtualization and allow override of poller_tag.
Oct 10, 2013
0ae1d57
add business_impact to service definitions
cyberflow Oct 28, 2013
25787fd
fix syntax error
cyberflow Oct 28, 2013
7e82e0c
fix syntax error
cyberflow Oct 28, 2013
d15ee9d
fix type to integer
cyberflow Oct 28, 2013
e9886e2
Merge pull request #2 from cyberflow/1.x
Oct 28, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ There is a number of roles which are available to you:
- ``shinken-poller``
- ``shinken-scheduler``

To use the recipes, you must create the following data bags:

shinken_commands
shinken_contacts
shinken_contact_templates
shinken_escalations
shinken_hostgroups
shinken_hosts
shinken_host_templates
shinken_modules
shinken_notificationways
shinken_servicegroups
shinken_services
shinken_service_templates
shinken_timeperiods

See the examples directory for example roles and data bag entries.

## License and author

Copyright 2013, Arthur Gautier
Expand Down
29 changes: 26 additions & 3 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

case node['platform_family']
when 'rhel'
default["shinken"]["core_package"] = "shinken"
default["shinken"]["run_dir"] = "/var/run/shinken"
default["shinken"]["work_dir"] = "/var/lib/shinken"
default["shinken"]["bin_dir"] = "/usr/sbin"
else
default["shinken"]["core_package"] = "shinken-core"
default["shinken"]["run_dir"] = "/var/run/nagios"
default["shinken"]["work_dir"] = "/var/lib/nagios"
default["shinken"]["bin_dir"] = "/usr/bin"
end

default["shinken"]["log_dir"] = "/var/log/shinken"

default["shinken"]["scheduler" ]["port"] = 7768
default["shinken"]["reactionner"]["port"] = 7769
Expand All @@ -44,13 +58,22 @@

default["shinken"]["scheduler" ]["variables"] = default_variables
default["shinken"]["arbiter" ]["variables"] = default_variables
default["shinken"]["poller" ]["variables"] = default_variables
default["shinken"]["broker" ]["variables"] = default_variables
default["shinken"]["poller" ]["variables"] = default_variables.merge({
"manage_sub_realms" => 0,
"min_workers" => 0,
"max_workers" => 0,
"processes_by_worker" => 256,
"polling_interval" => 1
})
default["shinken"]["broker" ]["variables"] = default_variables.merge({
"manage_sub_realms" => 1,
"manage_arbiters" => 1
})
default["shinken"]["receiver" ]["variables"] = default_variables
default["shinken"]["reactionner"]["variables"] = default_variables.merge({
"manage_sub_realms" => 0,
"min_workers" => 1,
"max_workers" => 15
})


default["shinken"]["auto_poller_tags"] = false
6 changes: 6 additions & 0 deletions attributes/pnp.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
case node['platform_family']
when 'rhel'
default["shinken"]["pnp"]["fpm"] = "php-fpm"
else
default["shinken"]["pnp"]["fpm"] = "php5-fpm"
end
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_commands/check_host_alive.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "check_host_alive",
"command_name": "check_host_alive",
"command": "$PLUGINSDIR$/check_ping",
"arguments": ["-H", "$HOSTADDRESS$", "-w", "1000,100%", "-c", "3000,100%", "-p", "1"]
}

6 changes: 6 additions & 0 deletions examples/data_bags/shinken_commands/notify_host_by_email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "notify_host_by_email",
"command_name": "notify_host_by_email",
"command": "/usr/bin/printf",
"arguments": [ "\"%b\"", "\"Shinken Notification\\n\\nType:$NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\nDate/Time: $DATE$\\n\"", "|", "/bin/mail", "-s", "\"Host $HOSTSTATE$ alert for $HOSTNAME$!\" $CONTACTEMAIL$"]
}
6 changes: 6 additions & 0 deletions examples/data_bags/shinken_commands/notify_host_by_xmpp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "notify_host_by_xmpp",
"command_name": "notify_host_by_xmpp",
"command": "/usr/local/bin/xmppsend",
"arguments": ["-a", "/usr/local/etc/xmppsend.ini", "\"$NOTIFICATIONTYPE$: Host '$HOSTNAME$' is $HOSTSTATE$: $HOSTOUTPUT$\"", "$CONTACTPAGER$"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "notify_service_by_email",
"command_name": "notify_service_by_email",
"command": "/usr/bin/printf",
"arguments": [ "\"%b\"", "\"Shinken Notification\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $DATE$ Additional Info : $SERVICEOUTPUT$\\n\"", "|", "/bin/mail", "-s", "\"** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\" $CONTACTEMAIL$"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "notify_service_by_xmpp",
"command_name": "notify_service_by_xmpp",
"command": "/usr/local/bin/xmppsend",
"arguments": ["-a", "/usr/local/etc/xmppsend.ini", "\"$NOTIFICATIONTYPE$: Service $HOSTNAME$ $SERVICEDESC$ is $SERVICESTATE$: $SERVICEOUTPUT$\"", "$CONTACTPAGER$"]
}
11 changes: 11 additions & 0 deletions examples/data_bags/shinken_contact_templates/admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "admin",
"use": ["generic-contact"],
"host_notifications_enabled": true,
"service_notifications_enabled": true,
"email": "[email protected]",
"can_submit_commands": true,
"notificationways": ["xmpp"],
"is_admin": true,
"register": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "client-contact",
"use": ["generic-contact"],
"is_admin": false,
"register": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "deployment-contact",
"use": ["generic-contact"],
"host_notifications_enabled": true,
"service_notifications_enabled": true,
"email": "[email protected]",
"notificationways": ["email"],
"is_admin": false,
"register": false
}
11 changes: 11 additions & 0 deletions examples/data_bags/shinken_contact_templates/generic_contact.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "generic-contact",
"host_notifications_enabled": false,
"service_notifications_enabled": false,
"email": "root@localhost",
"can_submit_commands": false,
"notificationways": ["email"],
"contactgroups": "+all",
"is_admin": true,
"register": false
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_contacts/deployment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "deployment",
"comment": "Deployment User",
"email": "[email protected]",
"groups": ["deployment"],
"use": ["deployment-contact"]
}
9 changes: 9 additions & 0 deletions examples/data_bags/shinken_escalations/deployment_email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "deployment_email",
"first_notification_time": 30,
"last_notification_time": 0,
"notification_interval": 60,
"escalation_period": "24x7",
"escalation_options": [ "critical", "recovery"],
"contact_groups": ["deployment"]
}
9 changes: 9 additions & 0 deletions examples/data_bags/shinken_escalations/sysadmin_email.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "sysadmin_email",
"first_notification_time": 60,
"last_notification_time": 0,
"notification_interval": 60,
"escalation_period": "24x7",
"escalation_options": ["warning", "unknown", "critical", "recovery"],
"contact_groups": ["sysadmin"]
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_host_templates/centos-host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "centos-host",
"use": ["generic-host"],
"hostgroups": ["+linux", "centos"],
"icon_image": "centos.png",
"icon_image_alt": "Centos"
}
20 changes: 20 additions & 0 deletions examples/data_bags/shinken_host_templates/generic-host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"id": "generic-host",
"hostgroups": ["+all"],
"check_command": "check_host_alive",
"max_check_attempts": 2,
"check_interval": 5,
"active_checks_enabled": true,
"check_period": "24x7",
"contact_groups": ["sysadmin"],
"notification_interval": 60,
"notification_period": "24x7",
"notification_options": ["down", "unreachable", "recovery", "flapping"],
"notifications_enabled": true,
"event_handler_enabled": true,
"flap_detection_enabled": true,
"process_perf_data": true,
"notes_url": "/pnp4nagios/index.php/graph?host=$HOSTNAME$&srv=_HOST_",
"escalations": "deployment_email",
"register": false
}
6 changes: 6 additions & 0 deletions examples/data_bags/shinken_host_templates/no-chef-host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": "no-chef-host",
"hostgroups": ["+no_chef", "monitoring"],
"use": ["generic-host"],
"register": false
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_host_templates/windows-host.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "windows-host",
"use": ["generic-host"],
"hostgroups": ["windows"],
"icon_image": "win40.png",
"icon_image_alt": "Windows"
}
5 changes: 5 additions & 0 deletions examples/data_bags/shinken_hostgroups/all.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "all",
"hostgroup_name": "all",
"hostgroup_alias": "All"
}
5 changes: 5 additions & 0 deletions examples/data_bags/shinken_hostgroups/no_chef.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "no_chef",
"hostgroup_name": "no_chef",
"hostgroup_alias": "no_chef"
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_hosts/jira.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "jira",
"host_name": "jira",
"address": " 1.2.3.5",
"host_alias": "jira.example.com",
"hostgroups": ["+prod", "mysql-master", "mysql", "jira"],
"use": ["no-chef-host","centos-host","generic-host"]
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_hosts/tomcat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "tomcat",
"host_name": "tomcat",
"address": "1.2.3.8",
"host_alias": "tomcat.example.com",
"hostgroups": ["+prod", "example.com", "tomcat"],
"use": ["no-chef-host","centos-host","generic-host"]
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_hosts/windows.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "windows",
"host_name": "windows",
"address": "1.2.3.7",
"host_alias": "windows.example.com",
"hostgroups": ["+prod", "bi"],
"use": ["no-chef-host","windows-host","generic-host"]
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_hosts/wordpress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "wordpress",
"host_name": "wordpress",
"address": "1.2.3.6",
"host_alias": "wordpress.example.com",
"hostgroups": ["+prod", "mysql-master", "wordpress"],
"use": ["no-chef-host","centos-host","generic-host"]
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/apache_passwd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "Apache_passwd",
"type": "passwd_webui",
"variables": {
"passwd": "/etc/shinken/htpasswd.users"
}
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/commandfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "CommandFile",
"type": "named_pipe",
"variables": {
"command_file": "rw/nagios.cmd"
}
}
9 changes: 9 additions & 0 deletions examples/data_bags/shinken_modules/livestatus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "Livestatus",
"type": "livestatus",
"variables": {
"host": "*",
"port": "50000"
},
"modules": ["mongologs"]
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_modules/mongodb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "Mongodb",
"type": "mongodb",
"variables": {
"uri": "mongodb://localhost/?safe=true",
"database": "shinken"
}
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/mongologs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "mongologs",
"type": "logstore_mongodb",
"variables": {
"mongodb_uri": "mongodb://localhost/?safe=true"
}
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/npcdmod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "NPCDMOD",
"type": "npcdmod",
"variables": {
"config_file": "/etc/pnp4nagios/npcd.cfg"
}
}
4 changes: 4 additions & 0 deletions examples/data_bags/shinken_modules/nrpe_booster.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"id": "NrpeBooster",
"type": "nrpe_poller"
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/pickle_retention.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "PickleRetention",
"type": "pickle_retention_file_generic",
"variables": {
"path": "/tmp/retention.dat"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "PickleRetentionAribiter",
"type": "pickle_retention_file_generic",
"variables": {
"path": "/var/tmp/retention_arbiter.dat"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "PickleRetentionBroker",
"type": "pickle_retention_file_generic",
"variables": {
"path": "/var/tmp/retention_broker.dat"
}
}
7 changes: 7 additions & 0 deletions examples/data_bags/shinken_modules/pnp_ui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"id": "PNP_UI",
"type": "pnp_webui",
"variables": {
"uri": "http://mysite.example.com/pnp4nagios/"
}
}
8 changes: 8 additions & 0 deletions examples/data_bags/shinken_modules/simplelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "Simple-log",
"type": "simple_log",
"variables": {
"path": "/var/log/shinken/shinken.log",
"archive_path": "archives/"
}
}
4 changes: 4 additions & 0 deletions examples/data_bags/shinken_modules/syslog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"id": "Syslog",
"type": "syslog"
}
14 changes: 14 additions & 0 deletions examples/data_bags/shinken_modules/webui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "WebUI",
"type": "webui",
"variables": {
"host": "0.0.0.0",
"port": "7767",
"auth_secret": "put your secret here!",
"allow_html_output": "0",
"max_output_length": "100",
"manage_acl": "1",
"play_sound": "0"
},
"modules": ["Apache_passwd", "Mongodb", "PNP_UI"]
}
Loading