Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_dyndns
This plugin determines the current external address (by checking with checkip.dyndns.org). Then it finds the address known to DNS. If they do not match, there are two possibilites:
1. Just report the problem (as CRITICAL)
2. Correct the problem (if credentials to do so are given) and return as WARNING state.
Dyndns says not to query their checkip-host more often than every ten minutes, therefore a cache file is used to store the last known result and a new query is only done, if the ten minutes have passed (very useful, if you have multiple hostnames registered with dyndns - otherwise just increase the check_interval in nagios).
- Usage: check_dyndns host-to-check [dyndns-credentials]
- host-to-check - is the host (e.g. mylovelyhost@dyndns.org)
- dyndns-credentials - if present, use these to update the address (format: user:password)
Notes:
* DO NOT put the credentials in the object descriptions or commands! Consider using a $USERxx$ macro for this purpose.
* If using a proxy server to access the internet, you can set it in the script at the very beginning (CurlHttpProxy=)
* The location of the cache-file can also be changed there (LastCheckFile=)
1. Just report the problem (as CRITICAL)
2. Correct the problem (if credentials to do so are given) and return as WARNING state.
Dyndns says not to query their checkip-host more often than every ten minutes, therefore a cache file is used to store the last known result and a new query is only done, if the ten minutes have passed (very useful, if you have multiple hostnames registered with dyndns - otherwise just increase the check_interval in nagios).
- Usage: check_dyndns host-to-check [dyndns-credentials]
- host-to-check - is the host (e.g. mylovelyhost@dyndns.org)
- dyndns-credentials - if present, use these to update the address (format: user:password)
Notes:
* DO NOT put the credentials in the object descriptions or commands! Consider using a $USERxx$ macro for this purpose.
* If using a proxy server to access the internet, you can set it in the script at the very beginning (CurlHttpProxy=)
* The location of the cache-file can also be changed there (LastCheckFile=)
Reviews (3)
byBlackJack, March 14, 2013
…can be resolved by replacing `sh` by `bash` in the first line, because [[ is Bash syntax but `sh` may point to a different shell.
byleb0rtran, February 26, 2013
hi,
i get the following error if i try the script as root user:
root@...:/usr/lib/nagios/plugins# ./check_dyndns mydomain@dyndns.org
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
cat: /var/cache/nagios/check_dyndnsip.last: Datei oder Verzeichnis nicht gefunden
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
INTERNAL ERROR: Status code not properly set! [cache: no file] [query: no]
if i create the directory /var/cache/nagios/ and empty file /var/cache/nagios/check_dyndnsip.last, the following error appears:
root@...:/usr/lib/nagios/plugins# ./check_dyndns ...@dyndns.org
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
INTERNAL ERROR: Status code not properly set! [cache: no file] [query: no]
i get the following error if i try the script as root user:
root@...:/usr/lib/nagios/plugins# ./check_dyndns mydomain@dyndns.org
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
cat: /var/cache/nagios/check_dyndnsip.last: Datei oder Verzeichnis nicht gefunden
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
INTERNAL ERROR: Status code not properly set! [cache: no file] [query: no]
if i create the directory /var/cache/nagios/ and empty file /var/cache/nagios/check_dyndnsip.last, the following error appears:
root@...:/usr/lib/nagios/plugins# ./check_dyndns ...@dyndns.org
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
./check_dyndns: 112: [[: not found
INTERNAL ERROR: Status code not properly set! [cache: no file] [query: no]
bysvg, May 23, 2012
Hi,
thanks for your good script. this helped me to code it myself. Thanks!
i did some small modification to use a specific DNS as if you run such script behind your dyndns router and the router is a DNS server itself it could not resolve the "wrong" dns...
so the Host query section needs a external DNS server. What i did?
added in the parameters section this:
CurlHttpProxy=
DNSServer2use=
and in line 74 this:
HostResult=`host $DdnsHost $DNSServer2use`
now you simply put the IP of a external DNS server into the variable and "host" will use this to place the query to find "definedIP".
again: thanks for your good script!
cheers
Stephan
thanks for your good script. this helped me to code it myself. Thanks!
i did some small modification to use a specific DNS as if you run such script behind your dyndns router and the router is a DNS server itself it could not resolve the "wrong" dns...
so the Host query section needs a external DNS server. What i did?
added in the parameters section this:
CurlHttpProxy=
DNSServer2use=
and in line 74 this:
HostResult=`host $DdnsHost $DNSServer2use`
now you simply put the IP of a external DNS server into the variable and "host" will use this to place the query to find "definedIP".
again: thanks for your good script!
cheers
Stephan