By Shai Coleman
March 2014
/etc/shinken/shinken.cfg
# check immediately after reload
max_service_check_spread=0
max_host_check_spread=0
/etc/shinken/templates/generic-host.cfg
# check every minute
check_interval 1
# consider down after 10 minutes
max_check_attempts 10
/etc/shinken/shinken.cfg
/etc/shinken/commands/http.cfg
A custom commands that check HTTP/HTTPS response
# Syntax: check_command http!server!/path!content
define command {
command_name http
command_line $PLUGINSDIR$/check_http $ARG4$ $ARG5$
-H "$ARG1$" -u "$ARG2$" -s "$ARG3$"
}
# Syntax: check_command https!server!/path!content
define command {
command_name https
command_line $PLUGINSDIR$/check_http $ARG4$ $ARG5$ --ssl
-H "$ARG1$" -u "$ARG2$" -s "$ARG3$"
}
/etc/shinken/hosts/example.com.cfg
An example host with a sample service
define host {
use generic-host,linux,linux-snmp
contact_groups admins
host_name example.com
max_check_attempts 15
_fs /,/home,/var,/tmp
}
define service {
use generic-service
host_name example.com
service_description HTTP example.com
check_command https!example.com!/login!google-analytics.com
}
apt-get install snmpd
/etc/snmpd/snmpd.conf
# listen on all interfaces
agentAddress udp:161,udp6:[::1]:161
# allow all OIDs to be queried
view systemonly included .1
# restrict by host
rocommunity public shinken.example.com
Create a URL path in your web apps that monitors
the various aspects of the app, e.g.
Make sure that it prints a success message
and check that via Shinken
/etc/shinken/commands/extend.cfg
# Syntax: check_command extend!server!command
define command {
command_name extend
command_line $PLUGINSDIR$/check_snmp_extend.py -H "$ARG1$" -e "$ARG2$"
}
/etc/snmpd/snmpd.conf
extend mailq /bin/bash -c
"MAILQ=$(/usr/bin/find /var/mailq -nowarn -type f | wc -l);
STATUS=OK; CODE=0;
[ \"$MAILQ\" -ge 50 ] && STATUS=WARNING && CODE=1;
echo \"$STATUS: $MAILQ mails|mailq=$MAILQ\";
exit $CODE"