services.cfg gennerated with only one unique check_command

Support requests, bug reports, questions etc.
Locked
taenus
services.cfg gennerated with only one unique check_command

Post by taenus » Fri May 08, 2009 16:30

After rebuilding a Nagios servers config using NConf, I did the export and the services.cfg file that was generated used "service_is_stale" for EVERY services check_command attribute. I've got a variety of services being check, thou most use check_nrpe.

I do see in generate_config.pl, about line 717 where this value is hardcoded, but my perl is a little week. The if logic seems to always do this.

Any ideas why I'm getting this?

taenus

Re: services.cfg gennerated with only one unique check_command

Post by taenus » Fri May 08, 2009 16:43

I put a print after a true if to see what was happening.

Here is the code change,

Code: Select all

                # add "service is stale" to all services of a monitor server
                if($attr->[0] eq "check_command" && $path =~ /$monitor_path/){
`echo "if($attr->[0] eq \"check_command\" && $path =~ /$monitor_path/)" >> /tmp/nconf.log`;
$attr->[1] = "service_is_stale"}
                elsif($attr->[0] eq "check_command" && $path =~ /$collector_path/){
                    my $cmd_params = fetch_cmd_params($id_item->[0]);
                    $attr->[1] = $attr->[1].$cmd_params;
                }
And in the log file, I get this line, once per service that is outputted,

Code: Select all

if(check_command eq check_command && /var/www/html/nconf/temp/nagoma01prd/services.cfg =~ //)

User avatar
agargiulo
NConf developer
NConf developer
Posts:725
Joined:Fri Mar 06, 2009 17:50
Location:Zurich, Switzerland
Contact:

Re: services.cfg gennerated with only one unique check_command

Post by agargiulo » Fri May 08, 2009 16:54

Hi.

This is the intended behavior in NConf 1.2.4:
Collector servers run active checks, Monitor servers only run passive checks, so all services on the Monitor server point to a dummy checkcommand named "service_is_stale".

After several discussions (in this forum), we decided to change this behavior in NConf 1.2.5. The user may now decide himself if he wants to do active checking on Monitor servers also. The default is still no, but by editing the "active_checks_enabled" flag on the Monitor server, you can now override "service_is_stale" and execute the proper checkcommands.

NConf 1.2.5 will be released withing the next 2-3 weeks.

taenus

Re: services.cfg gennerated with only one unique check_command

Post by taenus » Fri May 08, 2009 17:13

So is there a combination of defining the Nagios system as monitor and/or collector and the "monitored by" and "host is collector" host attributes that would let my single Nagios server perform active checks?

taenus

Re: services.cfg gennerated with only one unique check_command

Post by taenus » Fri May 08, 2009 17:41

Thanks for your continued help. I believe I have a working system, though I'm not sure it's the correct way.

"nagios" is defined as collector.
"nagios-mon" is defined as a monitor.
"cfn" the host, is "monitored by" "nagios"
"cfn" the host has "host is collector" set to yes.

Two configs get generated, but I ignore the "nagios_mon" directory and my active checks are now in the services.cfg as I would expect them. "nagios_mon" config directory now has the "service_is_stale" checks, buy I don't link that directory into my nagios.cfg.

User avatar
agargiulo
NConf developer
NConf developer
Posts:725
Joined:Fri Mar 06, 2009 17:50
Location:Zurich, Switzerland
Contact:

Re: services.cfg gennerated with only one unique check_command

Post by agargiulo » Mon May 11, 2009 10:06

You don't necessarily have to specify a "Nagios-Monitor" server. For a simple environment it's enough to just create one "Collector".

Locked