1 2 3 4 5 6 7 8 9 10 11 | # 'check_agent' command definition define command{ command_name check_agent command_line $USER1$/check_agent $HOSTADDRESS$ } #'submit_check_result' command definition define command{ command_name submit_check_result command_line $USER1$/eventhandlers/submit_check_result } |
1 2 3 4 5 6 7 8 9 10 11 12 | # Define a service to check Denali Agent on the this windows machine "my_host_name". define service{ use generic-service ; Name of service template to use host_name my_host_name ; Host name to be monitored service_description Director Agent ; Service Name event_handler submit_check_result ; Event handler command name check_command check_agent ; Developed plugins command name max_check_attempts 1 ; Max times for the attempt active_checks_enabled 1 ; Active mode enabled passive_checks_enabled 1 ; Passive mode enabled is_volatile 1 ; If it is a volatile service } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | int main (int argc, char **argv) { int result = STATE_UNKNOWN; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); alarm (socket_timeout); /* Get the status of the host */ result = check_agent(server_name, port, ...); alarm (0); return (result); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #!/bin/sh # SUBMIT_CHECK_RESULT # Written by Ethan Galstad (nagios@nagios.org) # Last Modified: 02-18-2002 # # This script will write a command to the Nagios command # file to cause Nagios to process a passive service check # result. Note: This script is intended to be run on the # same host that is running Nagios. If you want to # submit passive check results from a remote machine, look # at using the nsca addon. # # Arguments: # $1 = host_name (Short name of host that the service is # associated with) # $2 = svc_description (Description of the service) # $3 = return_code (An integer that determines the state # of the service check, 0=OK, 1=WARNING, 2=CRITICAL, # 3=UNKNOWN). # $4 = plugin_output (A text string that should be used # as the plugin output for the service check) # echocmd="/bin/echo" CommandFile="/usr/local/nagios/var/rw/nagios.cmd" # get the current date/time in seconds since UNIX epoch datetime=`date +%s` # create the command line to add to the command file cmdline="[$datetime] PROCESS_SERVICE_CHECK_RESULT;$1;$2;$3;$4" # append the command to the end of the command file `$echocmd $cmdline >> $CommandFile` |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | EVENT ibmSystemTrapPowerSupply .1.3.6.1.4.1.2.6.159.1.1.0.23 "Status Alarms" Critical FORMAT $5 EXEC /usr/local/nagios/libexec/eventhandlers/submit_check_result $A "Director Agent" 2 "$5" SDESC "This event is sent when the Remote Supervisor Adapter detects that the state of a system's power supply changes with respect to availability." Variables: 1: ibmSystemTrapPowerSupplyIdentifier Syntax="String (Octet String) " Descr="" 2: ibmSystemTrapPowerSupplySourceObjectPath Syntax="String (Octet String) " Descr="" 3: ibmSystemTrapPowerSupplyTargetObjectPath Syntax="String (Octet String) " Descr="" 4: ibmSystemTrapPowerSupplySeverity Syntax="Uint16 (Integer) (0..65535)" Descr="2=Critical -- A power supply in a system has failed." 5: ibmSystemTrapPowerSupplydescription Syntax="String (Octet String) " Descr="" 6: ibmSystemTrapErrorLogTimeStamp Syntax="Datetime (Octet String) " Descr="" EDESC # # |
1 2 3 4 5 6 7 | [TrapFiles] # A list of snmptt.conf files (this is NOT the snmptrapd.conf file). The COMPLETE path # and filename. Ex: '/etc/snmp/snmptt.conf' snmptt_conf_files = <<END /etc/snmp/snmptt.conf /etc/snmp/snmptt.conf.ibm END |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |