Ubuntu 12.04 LTS and Nagios

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
dominicw
Posts: 8
Joined: Tue Aug 06, 2013 3:14 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by dominicw »

Nope, installed only one time.
The only installations that I did after installing Nagios was installing Cacti.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by lmiltchev »

OK, I think we made a mistake here... Remove the check_http command definition that you added in the "/etc/nagios3commands.cfg":

Code: Select all

define command {
command_name check_http
command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$
}
This is already defined in the "/etc/nagios-plugins/config/http.cfg", that's why you get a "duplicate definition" error.

Verify your configuration by running:

Code: Select all

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg
If there are no errors, restart nagios:

Code: Select all

service nagios3 restart
Next, run the following commands:

Code: Select all

usermod -G nagios www-data
chown nagios:www-data /var/lib/nagios3/rw/nagios.cmd
service nagios3 restart
service apache2 restart
Go to the web interface, click on your "HTTP" service, then click on "Re-schedule the next check of this service" link from the "Service Commands" menu on the right and see if the status will change.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dominicw
Posts: 8
Joined: Tue Aug 06, 2013 3:14 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by dominicw »

/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg
[Most output cut out]
Total Warnings: 0
Total Errors: 0

Restart Apache and Nagios, did go to the Nagios web interface -> Services -> HTTP -> Re-schedule the next check of this host -> Pressed Commit -> Pressed Done.
Now the status is OK under the Services tab.

Service State Information
Current Status:
OK
(for 1d 6h 54m 51s)
Status Information: HTTP OK: HTTP/1.1 301 Moved Permanently - 559 bytes in 0,070 second response time
Performance Data: time=0,069996s;;;0,000000 size=559B;;;0
Current Attempt: 1/4 (HARD state)
Last Check Time: 2013-08-08 15:34:26
Check Type: ACTIVE
Check Latency / Duration: 2.035 / 0.079 seconds
Next Scheduled Check: 2013-08-08 15:39:26
Last State Change: 2013-08-07 08:41:52
Last Notification: N/A (notification 0)
Is This Service Flapping?
NO
(0.00% state change)
In Scheduled Downtime?
NO

Last Update: 2013-08-08 15:36:39 ( 0d 0h 0m 4s ago)

The host however stays down (in a red background color).

Certainly we've come alot further, do you know what caused initially the problem that the service was down?
And how does Nagios determine that the host is down?

google View Service Details For This Host
DOWN 2013-08-08 15:39:29 1d 6h 52m 8s CRITICAL - Network Unreachable (google.com)

Host Status:
DOWN
(for 1d 6h 52m 32s)
Status Information: CRITICAL - Network Unreachable (google.com)
Performance Data:
Current Attempt: 1/10 (HARD state)
Last Check Time: 2013-08-08 15:40:39
Check Type: ACTIVE
Check Latency / Duration: 0.183 / 0.036 seconds
Next Scheduled Active Check: 2013-08-08 15:45:49
Last State Change: 2013-08-07 08:48:32
Last Notification: 2013-08-07 08:48:32 (notification 1)
Is This Host Flapping?
NO
(0.00% state change)
In Scheduled Downtime?
NO
Last Update: 2013-08-08 15:40:59 ( 0d 0h 0m 5s ago)

Thanks so much for the help so far!
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by lmiltchev »

Your host definition is:

Code: Select all

define host{
use generic-host
host_name google
alias google
address google.com
}
Unless you have a command, specified in the "generic-host" template, the check would fail, because you don't have a command defined. You can change your config to look like this:

Code: Select all

define host{
use generic-host
host_name google
alias google
address google.com
check_command check_http
}
...restart nagios:

Code: Select all

service nagios3 restart
and try your check again.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dominicw
Posts: 8
Joined: Tue Aug 06, 2013 3:14 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by dominicw »

Changed my config to this:

root@h2200554:/etc/nagios3/conf.d# cat test.cfg
define host{
use generic-host
host_name google
alias google
address google.com
check_command check_http
}

define service{
use generic-service
host_name google
service_description HTTP
check_command check_http
}

AND ALL WORKS FINE!!

My host is up in Nagios.

I can't tell you how much I appreciate the effort.

Thanks!

PS: Why do I still need the check_command check_http in the define_service area since its already defined in the host area?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Ubuntu 12.04 LTS and Nagios

Post by abrist »

dominicw wrote: PS: Why do I still need the check_command check_http in the define_service area since its already defined in the host area?
You don't necessarily need the service check, but if you want your host to populate certain portions of the interface (hostgroup summary, etc), you will need to define at least one service for the host.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked