Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_dyndns

Rating
4 votes
Favoured:
0
Hits
159406
Files:
FileDescription
check_dyndnscheck_dyndns
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Check-Plugin to verify an address registered with dyndns.org (and optionally to update the registered address upon detecting a mismatch!)
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=)
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]
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