2017/monitoring/nagios3/commands.cfg

129 lines
4.8 KiB
INI

###############################################################################
# COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS
###############################################################################
################################################################################
# NOTIFICATION COMMANDS
################################################################################
# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
################################################################################
# HOST CHECK COMMANDS
################################################################################
# On Debian, check-host-alive is being defined from within the
# nagios-plugins-basic package
################################################################################
# PERFORMANCE DATA COMMANDS
################################################################################
# 'process-host-perfdata' command definition
define command{
command_name process-host-perfdata
command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/lib/nagios3/host-perfdata.out
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/lib/nagios3/service-perfdata.out
}
###### custom snmp commands ######
define command {
command_name check_snmp_cisco
command_line /usr/lib/nagios/plugins/check_snmp -H $HOSTADDRESS$ -P 2c -C $USER3$ -o $ARG1$ $ARG2$ $ARG3$
}
define command {
command_name check_stream_count
command_line /usr/local/bin/count-streams.sh $ARG1$ $ARG2$
}
define command {
command_name check_rtmp
command_line /usr/lib/nagios/plugins/check_rtmp.sh -u $ARG1$ -t 5
}
define command {
command_name check_collectd
command_line /usr/bin/collectd-nagios -s /tmp/collectd.sock -H $HOSTALIAS$ -n $ARG1$ -w $ARG2$ -c $ARG3$
}
define command {
command_name notify-service-by-slack
command_line /usr/local/bin/slack_nagios.pl -field slack_channel=#noc -field HOSTALIAS="$HOSTNAME$" -field SERVICEDESC="$SERVICEDESC$" -field SERVICESTATE="$SERVICESTATE$" -field SERVICEOUTPUT="$SERVICEOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
}
define command {
command_name notify-host-by-slack
command_line /usr/local/bin/slack_nagios.pl -field slack_channel=#noc -field HOSTALIAS="$HOSTNAME$" -field HOSTSTATE="$HOSTSTATE$" -field HOSTOUTPUT="$HOSTOUTPUT$" -field NOTIFICATIONTYPE="$NOTIFICATIONTYPE$"
}
# check http with host and port
# check for grafana
define command {
command_name check_http_host_port
command_line /usr/lib/nagios/plugins/check_http -H $ARG1$ -I $ARG2$ -p $ARG3$
}
define command {
command_name check_tcp_port
command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p $ARG1$
}
define command {
command_name check_udp_port
command_line /usr/lib/nagios/plugins/check_udp -H $HOSTADDRESS$ -p $ARG1$
}
# for unbound
define command {
command_name custom_check_dns
command_line /usr/lib/nagios/plugins/check_dns -H openfest.org -s $HOSTADDRESS$ -a 79.98.105.21
}
# check dynamic interface status
define command {
command_name check_ifstat_snmp
command_line /etc/nagios3/commands/check-interface-up.sh $USER3$ $HOSTADDRESS$ $ARG1$
}
# uptime via snmp with warnings
define command {
command_name check_uptime_snmp
command_line /etc/nagios3/commands/check_uptime_snmp.pl -H $HOSTADDRESS$ -2 -C $USER3$ $ARG1$ $ARG2$ $ARG3$
}
# check dynamic interface status
define command {
command_name check_ifstat_snmp_ap
command_line /etc/nagios3/commands/check-interface-up.sh $USER4$ $HOSTADDRESS$ $ARG1$
}
# uptime via snmp with warnings
define command {
command_name check_uptime_snmp_ap
command_line /etc/nagios3/commands/check_uptime_snmp.pl -H $HOSTADDRESS$ -2 -C $USER4$ $ARG1$ $ARG2$ $ARG3$
}