Tag Archives: ip

nagios check_dns / check_ip example

Need to monitor an IP address / DNS entry with Nagios? Nagios has a plugin called check_dns just for that. The check commands are defined in this file: /etc/nagios-plugins/config/dns.cfg # ‘check_dns’ command definition define command{ command_name check_dns command_line /usr/lib/nagios/plugins/check_dns -H www.google.com -s ‘$HOSTADDRESS$’ } # ‘check_dig’ command definition define command{ command_name check_dig command_line /usr/lib/nagios/plugins/check_dig -H ‘$HOSTADDRESS$’ -l ‘$ARG1$’ } here is an alternate version I wrote to check the IP of a host, I could have used check_ip because I don’t think that command is taken, but instead I used my_check_dns: #my_check_dns command, checks to make sure a hostname resolved to a specified IP address: define command { command_name my_check_dns command_line /usr/lib/nagios/plugins/check_dns -H $ARG1$ -a $ARG2$ } this is how it would be implemented in a service: define service{ use generic-service ; Name of service template to use host_name mysite.com service_description check dns check_command my_check_dns!www.mysite.com!123.456.78.90 } Man Page: check_dns v1.4.14 (nagios-plugins 1.4.14) Copyright (c) 1999 Ethan Galstad <nagios @nagios.org> Copyright (c) 2000-2008 Nagios Plugin Development Team <nagiosplug [email protected]> This plugin uses the nslookup program to obtain the IP address for the given host/domain query. An optional DNS server to use may be specified. If no DNS server is specified, the default server(s) specified in /etc/resolv.conf will be used. Usage:check_dns -H host [-s server] [-a expected-address] [-A] [-t timeout] [-w warn] [-c crit] Options: -h, –help Print detailed help screen -V, –version Print version information -H, –hostname=HOST The name or address you want to query -s, –server=HOST Optional DNS server you … Continue reading

Posted in Security, Server Admin | Tagged , , , , | Leave a comment