LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-10-2011, 11:53 AM   #1
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Rep: Reputation: 1
Problem manually executing entry in Nagios checkcommands.cfg


Hello...

First I don't know Nagios. I've been left with a fairly large(350 servers, 750 services) Nagios system installed. I've scraped and googled till I'm blue in the face...

The Nagios folks have been less than helpful in that they tell me I need to figure it out myself. I've tried for four days to *figure it out myself*.

I have an entry in the checkcommands.cfg file:

# 'check_dns_external' command definition
define command{
command_name check_dns_external
command_line $USER1$/check_dns -H $HOSTNAME$ -t 60 -s 4.2.2.1 -a $HOSTADDRESS$
}


First, I don't understand what this command means and does. Next, I don't understand how to manually execute this command. I do know that the command in automatic mode has stopped working as Nagios tries to execute and I get an error message on the Service Status Types: Nagios alert page.

The alert doesn't come with any regularity as to time of day or availability of resources. Apparently, this Nagios command is executing randomly. It is waking me up several times a night and several times a day as we page out alerts via email.

I'm lost. Aside from bouncing the entire Nagios stack, which is not possible right away as this is a Production system, is there any way to manually execute the offending line described above? Again, I've asked the Nagios folks and they have declined to answer.

Thanks very much for your help. Also, if this is not the right forum to ask, please point me to the right place.

Blaine Miller
 
Old 03-10-2011, 01:56 PM   #2
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
To run this manually do this command:

Quote:
check_dns -H <hostname> -t 60 -s <dns-server> -a <ipaddress>
check_dns -H test.example.com -t 60 -s 192.168.0.1 -a 192.168.0.100
returned this:
Quote:
DNS OK: 0.006 seconds response time. test.example.com returns 192.168.0.100|time=0.006258s;;;0.000000
This returns that your DNS is ok. You can give it a -c and -w flag for the limit you find acceptable.

Like so:
Quote:
./check_dns -H test.example.com -t 60 -s 192.168.0.1 -w 0.003 -c 0.010
which returns a warning because 0.003 is below the returned value of 0.006.

I got this to run without the last entry -a.

Here is the usage from the check_dns. I am assuming the one you are running is a admin created script.

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 want to use for the lookup
-a, --expected-address=IP-ADDRESS|HOST
Optional IP-ADDRESS you expect the DNS server to return. HOST must end with
a dot (.). This option can be repeated multiple times (Returns OK if any
value match). If multiple addresses are returned at once, you have to match
the whole string of addresses separated with commas (sorted alphabetically).
-A, --expect-authority
Optionally expect the DNS server to be authoritative for the lookup
-w, --warning=seconds
Return warning if elapsed time exceeds value. Default off
-c, --critical=seconds
Return critical if elapsed time exceeds value. Default off
-t, --timeout=INTEGER
Seconds before connection times out (default: 10)

Hope this helps you.
 
Old 03-10-2011, 02:30 PM   #3
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Original Poster
Rep: Reputation: 1
Thanks D072330!

I have a couple of questions now that I have an answer. in the line you suggest:

check_dns -H <hostname> -t 60 -s <dns-server> -a <ipaddress>

what is the <hostname> I should use? Also, we're apparently not using an internal DNS server and I have no access to the external one. All this is being fronted by a *VIP* per my network guy.

Like I said, I'm really lost here.

Thanks! I really appreciate your help!

Blaine
 
Old 03-10-2011, 03:22 PM   #4
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
The hostname is the server you want to check. If you want to see DNS info for test.example.com this would be the hostname.

More info on the check_dns:

Quote:
check_dns v1.4.15-22-gd16f3 (nagios-plugins 1.4.15)
Copyright (c) 1999 Ethan Galstad <nagios@nagios.org>
Copyright (c) 2000-2008 Nagios Plugin Development Team
<nagiosplug-devel@lists.sourceforge.net>

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.
With this extra info you can see that if you do not supply a DNS server it will use the one it is configured to use in the /etc/resolv.conf file.

The best way to learn about this one is just to supply command line args to see what each one does. By the way if you read in the first message I sent the -a option is what you think the IP address will be. So if you use -a and give the wrong IP address you will get an error message like this:

Quote:
DNS CRITICAL - expected '192.168.0.100' but got '192.168.0.101'
 
Old 03-10-2011, 05:01 PM   #5
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Original Poster
Rep: Reputation: 1
OK... I think we're getting closer. The error message I'm getting is one and the same as the one you describe above.

Is the *it* you describe the Nagios server or some other server? Sorry, pronouns confuse me... I see DNS servers in the reslov.conf of the nagios server. I don't think these are the ones I'm supposed to use, right?

I have no server. From what I've been told, all I have is an IP(VIP). I have no server name or address that I can tell.


Thank you for your patience and help.

Blaine
 
Old 03-10-2011, 05:25 PM   #6
d072330
Member
 
Registered: Nov 2007
Location: USA
Distribution: CentOS 5/6
Posts: 186

Rep: Reputation: 6
Yeah sorry about that, "it" is your Nagios server and yes those are the DNS IP addresses that your server should be using.

What happens if you run this on the command line:

nslookup www.google.com

should get something like this:


Quote:
Non-authoritative answer:
www.google.com canonical name = www.l.google.com.
Name: www.l.google.com
Address: 74.125.95.147
Name: www.l.google.com
Address: 74.125.95.99
Name: www.l.google.com
Address: 74.125.95.103
Name: www.l.google.com
Address: 74.125.95.104
Name: www.l.google.com
Address: 74.125.95.105
Name: www.l.google.com
Address: 74.125.95.106
Then run:

nslookup www.google.com <ip address from your resolv.conf file>
ex: nslookup www.google.com 10.0.0.1

This will do a DNS lookup and you are telling it what DNS server to use.

Then do it for one of your local servers or PC's and you should get a reply like this:

Name: test.example.com
Address: 192.168.0.100

We will start here.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
commands.cfg [nagios] Xanios Linux - Newbie 18 07-30-2010 04:51 AM
[SOLVED] Nagios dependencies.cfg example file rutledgetome Linux - Software 2 03-17-2010 12:08 PM
[SOLVED] nagios.cfg errors. worm5252 Linux - Server 3 12-17-2009 09:39 PM
fstab entry to manually mount ntfs partitions james2b Linux - Newbie 11 12-17-2008 06:09 AM
nagios and contactgroups.cfg d2490n Linux - Software 3 03-20-2008 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration