Skip to content

Instantly share code, notes, and snippets.

@proffalken
Created April 27, 2012 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save proffalken/2508622 to your computer and use it in GitHub Desktop.
Save proffalken/2508622 to your computer and use it in GitHub Desktop.
Shinken Commands Configuration File
# Here are some sample commands for checking classics things like
# systems and websites
# -----------------------------------------------------------------
#
# Localhost checks
#
# -----------------------------------------------------------------
# Simple disk check for LOCALHOST ONLY!
define command {
command_name check_local_disks
command_line $PLUGINSDIR$/check_disk -w 10% -c 5% -x /dev/shm -e -l
}
define command {
command_name check_local_load
command_line $PLUGINSDIR$/check_load -w 3,3,3 -c 5,5,5
}
define command {
command_name check_local_mem
command_line $PLUGINSDIR$/check_mem.pl -f -w 10 -c 5
}
define command {
command_name check_local_swap
command_line $PLUGINSDIR$/check_swap -w 50% -c 25%
}
define command {
command_name check_local_cpu
command_line $PLUGINSDIR$/check_cpu -w 80 -c 90
}
# -----------------------------------------------------------------
#
# Classic network calls
#
# -----------------------------------------------------------------
# Simple tcp check
define command {
command_name check_tcp
command_line $PLUGINSDIR$/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}
# Check a DNS entry
define command {
command_name check_dig
command_line $PLUGINSDIR$/check_dig -H $HOSTADDRESS$ -l $ARG1$
}
# Ask a nrpe agent
define command {
command_name check_nrpe
command_line $PLUGINSDIR$/check_nrpe -H $HOSTADDRESS$ -t 9 -u -c $ARG1$
}
# Same but with arguments
define command {
command_name check_nrpe_args
command_line $PLUGINSDIR$/check_nrpe -H $HOSTADDRESS$ -t 9 -u -c $ARG1$ -a $ARG2$ $ARG3$ $ARG4$ $ARG5$
}
# Simple ping command
define command {
command_name check_ping
command_line $PLUGINSDIR$/check_ping -H $HOSTADDRESS$ -w 3000,100% -c 5000,100% -p 1
}
# Look at good ssh launch
define command {
command_name check_ssh
command_line $PLUGINSDIR$/check_ssh -H $HOSTADDRESS$
}
# Look at Oracle connection
define command {
command_name check_oracle_listener
command_line $PLUGINSDIR$/check_oracle --tns $HOSTADDRESS$
}
#### Then samples which are not really useful in the real world
#Pollertag is a advanced features for mix architectures. Look at the doc for it.
define command{
command_name check_linux_host_alive
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 22 -t 3
#poller_tag DMZ
#module_type nrpe_poller
}
#Pollertag is a advanced features for mix architectures. Look at the doc for it.
define command{
command_name check_host_alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 1,50% -c 2,70% -p 1
#poller_tag DMZ
#module_type nrpe_poller
}
define command{
command_name check_windows_host_alive
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 139 -t 3
#poller_tag DMZ
#module_type nrpe_poller
}
define command{
command_name check_local_disk
command_line $USER1$/check.sh $HOSTADDRESS$ -c $ARG1$ SERVICE $USER1$
#poller_tag DMZ
#module_type nrpe_poller
}
# Dummy check port command
define command{
command_name check_port
command_line /bin/ping localhost -c 1
#$USER1$/check.sh $HOSTADDRESS$ -c $ARG1$
#poller_tag DMZ
#module_type nrpe_poller
}
# Dummy check for mysql, always CRITICAL
define command{
command_name check_mysql
command_line $USER1$/check_dummy.sh 2
}
define command{
command_name check_dummy
command_line $USER1$/check_dummy.sh $ARG1$
#poller_tag DMZ
}
define command{
command_name check_utf8
command_line $USER1$/check_utf8.sh
}
define command{
command_name super_event_kill_everyone
command_line $USER1$/check.sh $HOSTADDRESS$ -c $ARG1$ SERVICE $_HOSTDELLSUCK$
}
# We say Http checks are always OK
define command{
command_name check_http2
command_line $USER1$/check_dummy.sh 1
#module_type nrpe_poller
}
define command{
command_name check-host-alive
command_line $USER1$/check.sh $HOSTADDRESS$ -c $ARG1$ HOST $_HOSTDELLSUCK$ $SERVICEDESC:srv-1:Service-2$ $SERVICEDESC::Service-30$ $HOSTADDRESS:$ $HOSTGROUPALIAS:linux-servers$
#module_type dummy_poller
}
define command{
command_name check_vm_cpu
command_line $USER1$/check_esx3.pl -H lulu
}
#### Now notification commands
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Shinken Notification\n\nType:$NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nDate/Time: $DATE$\n" | /usr/bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "Shinken Notification\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $DATE$ Additional Info : $SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
# For Android SMS things
# You need both reactionner_tag and module_type in most cases!
define command{
command_name notify-host-by-android-sms
command_line android_sms $CONTACTPAGER$ Host: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $HOSTSTATE$\nInfo: $OUTPUT$\nDate: $DATETIME$
reactionner_tag android_sms
module_type android_sms
}
define command{
command_name notify-service-by-android-sms
command_line android_sms $CONTACTPAGER$ Service: $SERVICEDESC$\nHost: $HOSTNAME$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nInfo: $OUTPUT$\nDate: $DATETIME$
reactionner_tag android_sms
module_type android_sms
}
#### And Discovery commands
define command{
command_name nmap_discovery
command_line $USER1$/nmap_discovery_runner.py -t $NMAPTARGETS$
}
define command{
command_name vmware_esx_discovery
command_line $USER1$/vmware_discovery_runner.py -V $VCENTER$ -u $VCENTERLOGIN$ -p $VCENTERPASSWORD$ -r "lower|nofqdn"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment