2014-04-24 17:53:34 +00:00
|
|
|
################################################################################
|
|
|
|
# Sample object config file for Nagios
|
|
|
|
#
|
|
|
|
# Read the documentation for more information on this configuration file. I've
|
|
|
|
# provided some comments here, but things may not be so clear without further
|
|
|
|
# explanation, so make sure to read the HTML documentation!
|
|
|
|
#
|
|
|
|
# Last Modified: 12-17-2005
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# COMMAND DEFINITIONS
|
|
|
|
#
|
|
|
|
# SYNTAX:
|
|
|
|
#
|
|
|
|
# define command{
|
|
|
|
# template <templatename>
|
|
|
|
# name <objectname>
|
|
|
|
# command_name <commandname>
|
|
|
|
# command_line <commandline>
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# WHERE:
|
|
|
|
#
|
|
|
|
# <templatename> = object name of another command definition that should be
|
|
|
|
# used as a template for this definition (optional)
|
|
|
|
# <objectname> = object name of command definition, referenced by other
|
|
|
|
# command definitions that use it as a template (optional)
|
|
|
|
# <commandname> = name of the command, as recognized/used by Nagios
|
|
|
|
# <commandline> = command line
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# SAMPLE NOTIFICATION COMMANDS
|
|
|
|
#
|
|
|
|
# These are some example notification commands. They may or may not work on
|
|
|
|
# your system without modification.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
# 'host-notify-by-email' command definition
|
|
|
|
define command{
|
|
|
|
command_name host-notify-by-email
|
|
|
|
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\nSource: $$(hostname)\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "Host $HOSTSTATE$ alert for $HOSTNAME$!" $CONTACTEMAIL$
|
|
|
|
}
|
|
|
|
|
|
|
|
# 'notify-by-epager' command definition
|
|
|
|
define command{
|
|
|
|
command_name notify-by-epager
|
|
|
|
command_line /usr/bin/printf "%b" "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nInfo: $SERVICEOUTPUT$\nSource: $$(hostname -s)\nDate: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" $CONTACTPAGER$
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# 'host-notify-by-epager' command definition
|
|
|
|
define command{
|
|
|
|
command_name host-notify-by-epager
|
|
|
|
command_line /usr/bin/printf "%b" "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nSource: $$(hostname -s)\nTime: $LONGDATETIME$" | /bin/mail -s "$NOTIFICATIONTYPE$ alert - Host $HOSTNAME$ is $HOSTSTATE$" $CONTACTPAGER$
|
|
|
|
}
|
|
|
|
|
|
|
|
# 'host-notify-by-ircbot' command definition
|
|
|
|
define command{
|
|
|
|
command_name host-notify-by-ircbot
|
2015-03-18 14:33:42 +00:00
|
|
|
command_line /usr/bin/printf "%b" "#fedora-noc $NOTIFICATIONTYPE$ - $HOSTALIAS$ is $HOSTSTATE$: $HOSTOUTPUT$ ($$(hostname -s)) $HOSTACKAUTHOR$ $SERVICEACKAUTHOR$" | /usr/local/bin/irc-colorize.py | nc -w 1 value01 5050
|
2014-04-24 17:53:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 'notify-by-email' command definition
|
|
|
|
define command{
|
|
|
|
command_name notify-by-email
|
|
|
|
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\nSource: $$(hostname)\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /bin/mail -s "** $NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
|
|
|
|
}
|
|
|
|
|
|
|
|
# 'notify-by-ircbot' command definition
|
|
|
|
define command{
|
|
|
|
command_name notify-by-ircbot
|
2015-03-18 14:33:42 +00:00
|
|
|
command_line /usr/bin/printf "%b" "#fedora-noc $NOTIFICATIONTYPE$ - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$: $SERVICEOUTPUT$ ($$(hostname -s)) $HOSTACKAUTHOR$ $SERVICEACKAUTHOR$" | /usr/local/bin/irc-colorize.py | nc -w 1 value01 5050
|
2014-04-24 17:53:34 +00:00
|
|
|
}
|
|
|
|
|
2015-12-14 19:50:54 +00:00
|
|
|
# 'host-notify-by-fedmsg' command definition
|
|
|
|
define command{
|
|
|
|
command_name host-notify-by-fedmsg
|
2015-12-15 18:07:46 +00:00
|
|
|
command_line /usr/bin/echo '{"type": "$NOTIFICATIONTYPE$", "host": "$HOSTALIAS$", "state": "$HOSTSTATE$", "output": "$HOSTOUTPUT$", "host_ack_author": "$HOSTACKAUTHOR$", "service_ack_author": "$SERVICEACKAUTHOR$"}' | fedmsg-logger --cert-prefix nagios --modname nagios --topic host.state.change --json-input
|
2015-12-14 19:50:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# 'notify-by-fedmsg' command definition
|
|
|
|
define command{
|
|
|
|
command_name notify-by-fedmsg
|
2015-12-15 18:07:46 +00:00
|
|
|
command_line /usr/bin/echo '{"type": "$NOTIFICATIONTYPE$", "host": "$HOSTALIAS$", "state": "$SERVICESTATE$", "service": "$SERVICEDESC$", "output": "$SERVICEOUTPUT$", "host_ack_author": "$HOSTACKAUTHOR$", "service_ack_author": "$SERVICEACKAUTHOR$"}' | fedmsg-logger --cert-prefix nagios --modname nagios --topic service.state.change --json-input
|
2015-12-14 19:50:54 +00:00
|
|
|
}
|
|
|
|
|
2014-04-24 17:53:34 +00:00
|
|
|
# 'notify-by-xmpp' command definition
|
2015-01-19 21:32:52 +00:00
|
|
|
#define command{
|
|
|
|
# command_name notify-by-xmpp
|
|
|
|
# command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Service: $SERVICEDESC$\nHost: $HOSTNAME$\nInfo: $SERVICEOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$
|
|
|
|
# }
|
2014-04-24 17:53:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
# 'host-notify-by-xmpp' command definition
|
2015-01-19 21:32:52 +00:00
|
|
|
#define command{
|
|
|
|
# command_name host-notify-by-xmpp
|
|
|
|
# command_line /usr/local/bin/xmppsend -a /etc/nagios/private/xmppnagios.ini "Host '$HOSTALIAS$' is $HOSTSTATE$\nInfo: $HOSTOUTPUT$\nDate: $LONGDATETIME$" $CONTACTEMAIL$
|
|
|
|
# }
|
2014-04-24 17:53:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# SAMPLE PERFORMANCE DATA COMMANDS
|
|
|
|
#
|
|
|
|
# These are sample performance data commands that can be used to send performance
|
|
|
|
# data output to two text files (one for hosts, another for services). If you
|
|
|
|
# plan on simply writing performance data out to a file, consider using the
|
|
|
|
# host_perfdata_file and service_perfdata_file options in the main config file.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
# '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/log/nagios/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/log/nagios/service-perfdata.out
|
|
|
|
}
|