#########################################################################################################
[root@localhost etc]# more objects/commands.cfg
################################################################################
#
# SAMPLE NOTIFICATION COMMANDS
#
# These are some example notification commands. They may or may not work on
# your system without modification. As an example, some systems will require
# you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
#
################################################################################
# 'notify-host-by-email' command definition
#define command{
# command_name notify-host-by-email
# command_line echo "Notification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTO
UTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /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 echo "Notification Type: $NOTIFICATIONTYPE$\nService: $SERVICEDESC$\nState: $SERVICESTATE$\nAddress: $HOSTADDRESS$\nInf
o: $SERVICEOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTNAME$/$SERVICEDESC$ is $SERVICESTAT
E$ **" $CONTACTEMAIL$
# }
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Nagios\nType: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nIn
fo: $HOSTOUTPUT$\nDate/Time: $LONGDATETIME$\n" | /usr/local/nagios/libexec/sendEmail -u "$NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE
$ " -f nagios_boosj@163.com -t $CONTACTEMAIL$ -s smtp.163.com -xu nagios_boosj -xp boosj87755600
}
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "Nagios\nType: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRES
S$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\nAdditional Info:\n$SERVICEOUTPUT$\n" | /usr/local/nagios/libexec/sendEmail -u " $NOTIFIC
ATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$" -f nagios_boosj@163.com -t $CONTACTEMAIL$ -s smtp.163.com -xu nagios_boos
j -xp boosj87755600
}
################################################################################
#
# SAMPLE HOST CHECK COMMANDS
#
################################################################################
# This command checks to see if a host is "alive" by pinging it
# The check must result in a 100% packet loss or 5 second (5000ms) round trip
# average time to produce a critical error.
# Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
# 'check-host-alive' command definition
define command{
command_name check-host-alive
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 250.0,40% -c 300.0,60% -p 5
}
###############################################################################
#snmp
# define command {
# command_name check_snmp_network
# command_line $USER1$/check_snmp_netint_21.pl -2 -f -e -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -w $ARG3$ -c $ARG4$ -d 200 -q -k -y -M -B -
m -P "$SERVICEPERFDATA$" -T "$LASTSERVICECHECK$"
# }
################################################################################
#
# SAMPLE SERVICE CHECK COMMANDS
#
# These are some example service check commands. They may or may not work on
# your system, as they must be modified for your plugins. See the HTML
# documentation on the plugins for examples of how to configure command definitions.
#
# NOTE: The following 'check_local_...' functions are designed to monitor
# various metrics on the host that Nagios is running on (i.e. this one).
################################################################################
# 'check_snmp_postfixqueue' command definition
define command{
command_name check_snmp_postfixqueue
command_line $USER1$/check_snmp_postfixqueue $ARG1$ $ARG2$ $ARG3$
}
# 'check_smtp' command definition
define command{
command_name check_smtp
command_line $USER1$/check_smtp -S -H $ARG1$ -U $ARG2$ -P $ARG3$ -C $ARG4$ -R $ARG5$ -C $ARG6$ -R $ARG7$ -w 2 -c 5 -t 10
}
# 'check_switches' command definition
define command{
command_name check_switches
command_line $USER1$/check_switches $ARG1$ $ARG2$
}
# 'check_local_disk' command definition
define command{
command_name check_local_disk
command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
}
# 'check_local_load' command definition
define command{
command_name check_local_load
command_line $USER1$/check_load -w $ARG1$ -c $ARG2$
}
# 'check_local_procs' command definition
define command{
command_name check_local_procs
command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
}
# 'check_local_users' command definition
define command{
command_name check_local_users
command_line $USER1$/check_users -w $ARG1$ -c $ARG2$
}
# 'check_local_swap' command definition
define command{
command_name check_local_swap
command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$
}
# 'check_mem' command definition
define command{
command_name check_mem
command_line $USER1$/check_mem.sh -w $ARG1$ -c $ARG2$
}
define command{
command_name check_iostat
command_line $USER1$/check_iostat -w $ARG1$ -c $ARG2$
}
define command{
command_name check_ntp
command_line $USER1$/check_ntp -H 192.168.3.206 -w $ARG1$ -c $ARG2$
}
# 'check_local_sensors' command definition
define command{
command_name check_temp_sp
command_line $USER1$/check_check_sensors -w $ARG1$ -c $ARG2$
}
# 'check_local_mrtgtraf' command definition
define command{
command_name check_local_mrtgtraf
command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
}
# 'check_traffic' command definitiondefine command
define command{
command_name check_traffic
command_line $USER1$/check_traffic.sh -V 1 -C nagios79admin4671 -H $HOSTADDRESS$ -I $ARG1$ -w $ARG2$ -c $ARG3$ -K -b
}
define command{
command_name check_traffic_sw
command_line $USER1$/check_traffic.sh -V 1 -C $ARG1$ -H $ARG2$ -I $ARG3$ -w $ARG4$ -c $ARG5$ -M -b
}
################################################################################
# NOTE: The following 'check_...' commands are used to monitor services on
# both local and remote hosts.
################################################################################
# 'check_ftp' command definition
define command{
command_name check_ftp
command_line $USER1$/check_ftp -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$
}
# 'check_hpjd' command definition
define command{
command_name check_hpjd
command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
}
# 'check_snmp' command definition
define command{
command_name check_snmp
command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
}
# 'check_http' command definition
define command{
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
# 'check_web' command definition
define command{
command_name check_web
command_line $USER1$/check_http -I $HOSTADDRESS$ -H $ARG1$ -u $ARG2$
}
# 'check_web' command definition
define command{
command_name check_web_ip
command_line $USER1$/check_http -I $ARG1$ -H $ARG2$ -u $ARG3$ -p $ARG4$
}
# 'check_ssh2' command definition
#define command{
# command_name check_ssh2
# command_line $USER1$/check_ssh -p $ARG1$ $HOSTADDRESS$
# }
# 'check_dhcp' command definition
define command{
command_name check_dhcp
command_line $USER1$/check_dhcp $ARG1$
}
# 'check_ping' command definition
define command{
command_name check_ping
command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
}
define command{
command_name check_ping_ip
command_line $USER1$/check_ping -H $ARG1$ -w $ARG2$ -c $ARG3$ -p 5
}
# 'check_pop' command definition
define command{
command_name check_pop
command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
}
# 'check_imap' command definition
define command{
command_name check_imap
command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
}
# 'check_smtp' command definition
#define command{
# command_name check_smtp
# command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
# }
# 'check_tcp' command definition
define command{
command_name check_lan_tcp
command_line $USER1$/check_tcp -H $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$ -t $ARG5$
}
# 'check_tcp' command definition
define command{
command_name check_tcp
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -t $ARG2$
}
define command{
command_name check_tcp1
command_line $USER1$/check_tcp -H $ARG1$ -p $ARG2$ -t $ARG3$
}
define command{
command_name check_tcp80
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -t $ARG2$ -w $ARG3$ -c $ARG4$
}
# 'check_udp' command definition
define command{
command_name check_udp
command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
}
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -t 15 -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_ssh
command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ -w $ARG2$ -c $ARG3$ -t $ARG4$
}
# 'check_nt' command definition
define command{
command_name check_nt
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -s nagios79admin4671 -v $ARG1$ $ARG2$
}
# 'check_nginx' command definition
define command{
command_name check_nginx_status
command_line $USER1$/check_nginx_status.sh -u $ARG1$ -p $ARG2$ -w $ARG3$ -c $ARG4$
}
define command{
command_name check_nginx
command_line $USER1$/check_nginx_stauts.pl $HOSTADDRESS$:$ARG1$ $ARG2$ $ARG3$ $ARG4$
}
# 'check_openmanage' command definition
define command{
command_name check_openmanage
command_line $USER1$/check_openmanage -H $HOSTADDRESS$ -C $ARG1$ --only $ARG2$
}
# 'check_snmp_stor" command definition
define command{
command_name check_snmp_stor
command_line $USER1$/check_snmp_storage.pl -H $HOSTADDRESS$ -C $ARG1$ -m $ARG2$ -w $ARG3$ -c $ARG4$ -f
}
define command{
command_name check_snmp_stor1
command_line $USER1$/check_snmp_storage.pl -H $ARG1$ -C $ARG2$ -m $ARG3$ -w $ARG4$ -c $ARG5$ -f
}
define command{
command_name check_snmp_mem1
command_line $USER1$/check_snmp_storage.pl -H $ARG1$ -C $ARG2$ -2 -m $ARG3$ -w $ARG4$ -c $ARG5$ -f
}
# 'check_snmp_load" command definition
define command{
command_name check_snmp_load
command_line $USER1$/check_snmp_load.pl -H $HOSTADDRESS$ -C $ARG1$ -w $ARG2$ -c $ARG3$ -f
}
define command{
command_name check_snmp_load1
command_line $USER1$/check_snmp_load.pl -H $ARG1$ -C $ARG2$ -w $ARG3$ -c $ARG4$ -f
}
define command{
command_name check_snmp_cpu1
command_line $USER1$/check_snmp_load.pl -H $ARG1$ -C $ARG2$ -2 -w $ARG3$ -c $ARG4$ -f
}
# 'check_snmp_proc" command definition
#define command{
# command_name check_snmp_proc
# command_line $USER1$/check_snmp_process.pl $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
# }
# 'check_snmp_proc" command definition
define command{
command_name check_snmp_proc
command_line $USER1$/check_snmp_proc.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
# 'check_snmp_conn" command definition
define command{
command_name check_snmp_conn
command_line $USER1$/check_snmp_conn.sh $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$
}
# 'check_snmp_network" command definition
define command{
command_name check_snmp_network
command_line $USER1$/check_snmp_int.pl -H $HOSTADDRESS$ -C $ARG1$ -n $ARG2$ -kB -Y -w $ARG3$,$ARG4$ -c $ARG5$,$ARG6$ -f
}
define command{
command_name check_snmp_network1
command_line $USER1$/check_snmp_int.pl -H $ARG1$ -C $ARG2$ -n $ARG3$ -kB -Y -w $ARG4$,$ARG5$ -c $ARG6$,$ARG7$ -f
}
define command{
command_name check_snmp_network2
command_line $USER1$/check_snmp_int.pl -H $ARG1$ -C $ARG2$ -2 -n $ARG3$ -kB -Y -w $ARG4$,$ARG5$ -c $ARG6$,$ARG7$ -f
}
define command{
command_name check_snmp_cpu
command_line $USER1$/check_snmp_cpu.sh -H $HOSTADDRESS$ -C $ARG1$
}
define command{
command_name check_remote_battery
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_remote_cpu
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_remote_fans
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$
}
define command{
command_name check_remote_hardware
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_remote_temp
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ -a $ARG2$ $ARG3$
}
define command{
command_name check_remote_voltage
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_pe_omreport
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
# check_raid
define command{
command_name check_raid
command_line $USER1$/check_raid $ARG1$
}
# check_raid_status
define command{
command_name check_raid_status
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
define command{
command_name check_nginxstatus
command_line $USER1$/check_nginx.sh -H $ARG1$ -P $ARG2$ -p $ARG3$ -n $ARG4$ -w $ARG5$ -c $ARG6$
}
#'check_mysql_health'
define command{
command_name check_mysql_health
command_line $USER1$/check_mysql_health --hostname $ARG1$ --port $ARG2$ --username $ARG3$ --password $ARG4$ --mode $ARG5$ --warning $
ARG6$ --critical $ARG7$
}
#check_nginx_error
define command{
command_name check_nginx_error
command_line $USER1$/check_nginx_error.sh --url $ARG1$ --host $ARG2$
}
################################################################################
#
# 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/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl -d HOSTPERFDATA
}
# 'process-service-perfdata' command definition
define command{
command_name process-service-perfdata
command_line /usr/bin/perl /usr/local/pnp4nagios/libexec/process_perfdata.pl
}
define command{
command_name process-service-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/service-perfdata /usr/local/pnp4nagios/var/spool/service-perfdata.$TIMET$
}
define command{
command_name process-host-perfdata-file
command_line /bin/mv /usr/local/pnp4nagios/var/host-perfdata /usr/local/pnp4nagios/var/spool/host-perfdata.$TIMET$
}
###############################################################################################