I am running Nagios 3.2.0 on Ubuntu 10.04. My problem is that Nagios keeps using outdated configuration information in several cases:
I created a host and a service. Since I called the service HTTP, I got a warning but Nagios started up fine. Because of the warning I renamed the service, and now it always shows the old and the new service in the Service Detail page.
I configured the commands notify-host-by-email and notify-service-by-email to send email to an external SMTP server. I restarted Nagios and got it to work. Then I updated the commands to format the email text more nicely. Now it looks like Nagios is still using the previous version of the command, i.e. emails are sent but not in the new format.
So I ran the following to clean up any old data:
service nagios3 stop
mv /var/log/nagios3/nagios.log /tmp
rm /var/log/nagios3/archives/*
mv /var/cache/nagios3/objects.cache /tmp
mv /var/lib/nagios3/retention.dat /tmp
service nagios3 start
Now the host and service history seem to be gone, but the 2 above issues still exist. What can I do?
I stopped the nagios3 service and checked for nagios processes; there were none. Then I deleted the above files and started the nagios3 service again. I still have the same problem. Are there any other files where nagios stores such information?
you don’t need to do anything on those files, the configuration is read at each start.
As it looks like you did an RPM install so you need to check exactly where your cfg files are located as that is package dependant and mostly not standard. You are probably modifying the wrong files.
This is the first time I use Nagios, so anything is possible. But I went over the configuration many times and I cannot find any flaw in what I did:
For Ubuntu 10.04 all configuration files seem to be under /etc/nagios3 and /etc/nagios-plugins
I added the line ‘cfg_dir=/etc/nagios3/objects’ to /etc/nagios3/nagios.cfg
I created the directory /etc/nagios3/objects and added 2 files into it. Each file has a host and a service definition.
I restarted Nagios and the hosts and services showed up.
I changed the service_description of both services since the validation complained about duplicate names.
I restarted Nagios and now I always see the old and new service definitions.
If I was editing the wrong files, why would my hosts and services show up in the first place?
On the other hand, maybe something is wrong with my service configuration:
define service {
use generic-service ; Inherit default values from a template
host_name objectaid.com
service_description HTTP-objectaid.com
check_command check_http
}
cause 2 service to appear: HTTP and HTTP-objectaid.com
But that’s the thing, I created the ‘objects’ directory myself and there is nothing else in there. I reduced it to a single configuration file with these contents:
define host {
use generic-host ; Inherit default values from a template
host_name objectaid.com ; The name we're giving to this host
alias objectaid.com ; A longer name associated with the host
address objectaid.com
hostgroups http-servers ; Host groups this host is associated with
}
define service {
use generic-service ; Inherit default values from a template
host_name objectaid.com
service_description HTTP-objectaid.com
check_command check_http
}
When the service_description is HTTP-objectaid.com I get 2 services, HTTP and HTTP-objectaid.com. When I change the service_description to HTTP I only get a single HTTP service.
There are other configurations active that came with Nagios, but how would they know about my host?
Anyway, it seems they do know my host because even if I remove the above service configuration the HTTP service still shows up for that host. Is this behavior standard for Nagios? I don’t see anything related to HTTP in the generic-host template.