Asjas

Commands.cfg

Nov 1st, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.48 KB | None | 0 0
  1. ###############################################################################
  2. # COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.2.2
  3. #
  4. #
  5. # NOTES: This config file provides you with some example command definitions
  6. #        that you can reference in host, service, and contact definitions.
  7. #      
  8. #        You don't need to keep commands in a separate file from your other
  9. #        object definitions.  This has been done just to make things easier to
  10. #        understand.
  11. #
  12. ###############################################################################
  13.  
  14.  
  15. ################################################################################
  16. #
  17. # SAMPLE NOTIFICATION COMMANDS
  18. #
  19. # These are some example notification commands.  They may or may not work on
  20. # your system without modification.  As an example, some systems will require
  21. # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below.
  22. #
  23. ################################################################################
  24.  
  25.  
  26. # 'notify-host-by-email' command definition
  27. define command{
  28.     command_name    notify-host-by-email
  29.     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$
  30.     }
  31.  
  32. # 'notify-service-by-email' command definition
  33. define command{
  34.     command_name    notify-service-by-email
  35.     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$
  36.     }
  37.  
  38.  
  39.  
  40.  
  41.  
  42. ################################################################################
  43. #
  44. # SAMPLE HOST CHECK COMMANDS
  45. #
  46. ################################################################################
  47.  
  48.  
  49. # This command checks to see if a host is "alive" by pinging it
  50. # The check must result in a 100% packet loss or 5 second (5000ms) round trip
  51. # average time to produce a critical error.
  52. # Note: Five ICMP echo packets are sent (determined by the '-p 5' argument)
  53.  
  54. # 'check-host-alive' command definition
  55. define command{
  56.         command_name    check-host-alive
  57.         command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
  58.         }
  59.  
  60.  
  61.  
  62.  
  63. ################################################################################
  64. #
  65. # SAMPLE SERVICE CHECK COMMANDS
  66. #
  67. # These are some example service check commands.  They may or may not work on
  68. # your system, as they must be modified for your plugins.  See the HTML
  69. # documentation on the plugins for examples of how to configure command definitions.
  70. #
  71. # NOTE:  The following 'check_local_...' functions are designed to monitor
  72. #        various metrics on the host that Nagios is running on (i.e. this one).
  73. ################################################################################
  74.  
  75. # 'check_local_disk' command definition
  76. define command{
  77.         command_name    check_local_disk
  78.         command_line    $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
  79.         }
  80.  
  81.  
  82. # 'check_local_load' command definition
  83. define command{
  84.         command_name    check_local_load
  85.         command_line    $USER1$/check_load -w $ARG1$ -c $ARG2$
  86.         }
  87.  
  88.  
  89. # 'check_local_procs' command definition
  90. define command{
  91.         command_name    check_local_procs
  92.         command_line    $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
  93.         }
  94.  
  95.  
  96. # 'check_local_users' command definition
  97. define command{
  98.         command_name    check_local_users
  99.         command_line    $USER1$/check_users -w $ARG1$ -c $ARG2$
  100.         }
  101.  
  102.  
  103. # 'check_local_swap' command definition
  104. define command{
  105.     command_name    check_local_swap
  106.     command_line    $USER1$/check_swap -w $ARG1$ -c $ARG2$
  107.     }
  108.  
  109.  
  110. # 'check_local_mrtgtraf' command definition
  111. define command{
  112.     command_name    check_local_mrtgtraf
  113.     command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$
  114.     }
  115.  
  116.  
  117. ################################################################################
  118. # NOTE:  The following 'check_...' commands are used to monitor services on
  119. #        both local and remote hosts.
  120. ################################################################################
  121.  
  122. # 'check_ftp' command definition
  123. define command{
  124.         command_name    check_ftp
  125.         command_line    $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$
  126.         }
  127.  
  128.  
  129. # 'check_hpjd' command definition
  130. define command{
  131.         command_name    check_hpjd
  132.         command_line    $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$
  133.         }
  134.  
  135.  
  136. # 'check_snmp' command definition
  137. define command{
  138.         command_name    check_snmp
  139.         command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
  140.         }
  141.  
  142.  
  143. # 'check_http' command definition
  144. define command{
  145.         command_name    check_http
  146.         command_line    $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
  147.         }
  148.  
  149.  
  150. # 'check_ssh' command definition
  151. define command{
  152.     command_name    check_ssh
  153.     command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
  154.     }
  155.  
  156.  
  157. # 'check_dhcp' command definition
  158. define command{
  159.     command_name    check_dhcp
  160.     command_line    $USER1$/check_dhcp $ARG1$
  161.     }
  162.  
  163.  
  164. # 'check_ping' command definition
  165. define command{
  166.         command_name    check_ping
  167.         command_line    $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
  168.         }
  169.  
  170.  
  171. # 'check_pop' command definition
  172. define command{
  173.         command_name    check_pop
  174.         command_line    $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$
  175.         }
  176.  
  177.  
  178. # 'check_imap' command definition
  179. define command{
  180.         command_name    check_imap
  181.         command_line    $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$
  182.         }
  183.  
  184.  
  185. # 'check_smtp' command definition
  186. define command{
  187.         command_name    check_smtp
  188.         command_line    $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$
  189.         }
  190.  
  191.  
  192. # 'check_tcp' command definition
  193. define command{
  194.     command_name    check_tcp
  195.     command_line    $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
  196.     }
  197.  
  198.  
  199. # 'check_udp' command definition
  200. define command{
  201.     command_name    check_udp
  202.     command_line    $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$
  203.     }
  204.  
  205.  
  206. # 'check_nt' command definition
  207. define command{
  208.     command_name    check_nt
  209.     command_line    $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$
  210.     }
  211.  
  212.  
  213.  
  214. ################################################################################
  215. #
  216. # SAMPLE PERFORMANCE DATA COMMANDS
  217. #
  218. # These are sample performance data commands that can be used to send performance
  219. # data output to two text files (one for hosts, another for services).  If you
  220. # plan on simply writing performance data out to a file, consider using the
  221. # host_perfdata_file and service_perfdata_file options in the main config file.
  222. #
  223. ################################################################################
  224.  
  225.  
  226. # 'process-host-perfdata' command definition
  227. define command{
  228.     command_name    process-host-perfdata
  229.     command_line    /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /usr/local/nagios/var/host-perfdata.out
  230.     }
  231.  
  232.  
  233. # 'process-service-perfdata' command definition
  234. define command{
  235.     command_name    process-service-perfdata
  236.     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" >> /usr/local/nagios/var/service-perfdata.out
  237.     }
  238.  
  239. #################################################################
  240. # NAGIOSGRAPH CHECK COMMAND                 #
  241. #                               #
  242. # command to process nagios performance data for nagiosgraph    #
  243. #                               #
  244. #                               #
  245. #################################################################
  246. define command {
  247.   command_name process-service-perfdata-for-nagiosgraph
  248.   command_line /usr/local/nagiosgraph/libexec/insert.pl
  249. }
  250.  
  251. ###############################################################################
  252. # NRPE CHECK COMMAND
  253. #
  254. # Command to use NRPE to check remote host systems
  255. ###############################################################################
  256. define command{
  257. command_name check_nrpe
  258. command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
  259. }
Add Comment
Please, Sign In to add comment