You are here

Help with check_domain plugin

3 posts / 0 new
Last post
Robert Miller
Robert Miller's picture
Help with check_domain plugin

Running Opsview Core on Ubuntu 12.04.

This is my first time trying to get a plugin installed that isn't included. I was able to get the Nagios plugin check_domain installed.

I am able to run it from the terminal as both the nagios user, and my own account.  It functions properly from the terminal and gives me the proper output. However, it doesn't work in Opsview.  Below is what I get when running the check in Opsview.


$ /usr/local/nagios/libexec/check_domain -d
 We do not support this domain (not integrated). Sorry.

 /usr/local/nagios/libexec/check_domain: 54: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 54: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 54: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 58: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 62: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 66: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 70: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 74: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 78: [: com: unexpected operator
 /usr/local/nagios/libexec/check_domain: 82: [: com: unexpected operator



Interestingly, this is the same exact output I get on the command line IF I attempt to run it with sudo.  Running the check_domain at the command line results in:

******@opsview:/usr/local/nagios/libexec$ ./check_domain -d     
OK - Domain will expire on  29-may-2016
******@opsview:/usr/local/nagios/libexec$ sudo su nagios
nagios@opsview:/usr/local/nagios/libexec$ ./check_domain -d  
OK - Domain will expire on  29-may-2016

Unless I run it with Sudo, which then it gives the same output as I posted above in Opsview.

I mirrored the permissions on the script to other scripts.

-rwxr-xr-x 1 nagios nagios   5461 Jan 12 17:10 check_domain
-rwxr-xr-x 1 nagios nagios  35232 Oct 16  2013 check_dummy

Any ideas?  I sure would appreicate the help.  I have a lot of domains to check and this would help me immensely.

Thanks in advance.


Robert Miller
Robert Miller's picture
Nevermind. I couldnt get it

Nevermind. I couldnt get it working. I switched to check_domain.php and that works.

I did have a problem however with GoDaddy domains. I only need the common us domains to work. All of my domains worked with check_domain.php version 1.1 except for GoDaddy domains. I ended up changing the line:

$cmd = 'whois '.$domain.' '. $whois_server .' | grep -i \'expir\|renew\|paid


$cmd = 'whois '.$domain.' '. $whois_server .' | grep -i \'expir\'';

and then all of domains worked.  GoDaddy lists a 'Status: clientRenewProhibited' before the expiration date and that was triggering the 'renew' portion of the grep statement. The author informed that removing this would cause a problem with euro domains but I don't that will affect me.

I'm sure I could make it better by somehow telling grep to ignore the line 'Status: clientRenewProhibited' but I don't know how to do that right now.

Great script, and I am very appreciative to have it!

Robert Miller
Robert Miller's picture
I'm sure it's stupid simple

I'm sure it's stupid simple for others but I figured out how to keep the author's original grep search and modify it to exclude the annoying 'Status: clientRenewProhibited' line from GoDaddy.  My final line for that script is as follows and all domains I've tested are working:

 $cmd = 'whois '.$domain.' '. $whois_server .' | grep -v "clientRenewProhibited" | grep -i \'expir\|renew\|paid-till\'';