Page 1 of 1
Seperately identify the Active and Passive check services
Posted: Mon Jan 22, 2018 10:58 pm
by yosh
Hi,
I got a mix of remote servers that are being monitored using both active and passive checks.
For instance:
Server A and its services : Active Monitoring
Server B and its services : Active Monitoring
Server C and its services : PassiveMonitoring
Server D and its services : Active Monitoring
Server E and its services : PassiveMonitoring
Server F and its services : Active Monitoring
Now I want to separately identify which servers/services are being monitored Actively/Passively.
Is it possible filter the service and hosts by its check method (Active/Passive) without checking its configuration individually ?
Re: Seperately identify the Active and Passive check service
Posted: Tue Jan 23, 2018 1:00 pm
by mcapra
You can parse
status.dat for practically anything regarding how the Nagios environment looks.
Active checks enabled:
Code: Select all
[root@capra_nag ~]# grep 'servicestatus' -A 42 /usr/local/nagios/var/status.dat | grep -B 42 'active_checks_enabled=1' | grep 'host_name\|service_description'
host_name=CENESPROD00
service_description=CPU Usage
host_name=CENESPROD00
service_description=Cluster Status
host_name=CENESPROD00
service_description=Heap Usage
host_name=CENESPROD00
service_description=Memory Usage
host_name=CENESPROD00
service_description=Ping
host_name=COLPROD02
service_description=Fail Count
host_name=COLPROD02
service_description=Queue Size
host_name=COLPROD03
service_description=Fail Count
host_name=COLPROD03
service_description=Queue Size
host_name=ESMARVELPROD00
service_description=CPU Usage
host_name=ESMARVELPROD00
service_description=Cluster Status
host_name=ESMARVELPROD00
service_description=Heap Usage
host_name=ESMARVELPROD00
service_description=Memory Usage
host_name=ESMARVELPROD00
service_description=Ping
host_name=PRODDELPHISCRIPTS
service_description=DataMart
host_name=PRODDELPHISCRIPTS
service_description=Graylog
host_name=PRODDELPHISCRIPTS
service_description=Logstash
host_name=PRODDELPHISCRIPTS
service_description=Process Monitor
Active checks disabled:
Code: Select all
[root@capra_nag ~]# grep 'servicestatus' -A 42 /usr/local/nagios/var/status.dat | grep -B 42 'active_checks_enabled=0' | grep 'host_name\|service_description'
host_name=COLPROD02
service_description=Fail Count
host_name=COLPROD02
service_description=Queue Size
host_name=COLPROD03
service_description=Fail Count
host_name=COLPROD03
service_description=Queue Size
There's probably also a limited API request you could send. Or a SQL query against the
nagios database. I guess it depends on where/how you want the information to shop up more than anything.
Re: Seperately identify the Active and Passive check service
Posted: Tue Jan 23, 2018 4:34 pm
by dwhitfield
mcapra wrote: Or a SQL query against the nagios database.
That is true, although we discourage accessing the database directly. Let us know if the solution presented above doesn't work and we can look at other solutions.
You could potentially check to see if active/passive are enabled on each check, but usually both are enabled (and you can send passive checks as a testing mechanism from the Advanced tab in the XI UI)
Re: Seperately identify the Active and Passive check service
Posted: Sun Jan 28, 2018 8:16 pm
by yosh
Hi
@mcapra,
Your grep command helped me to get it done. Thanks for the knowledge sharing.
I really appreciate that.!
Re: Seperately identify the Active and Passive check service
Posted: Mon Jan 29, 2018 12:23 pm
by kyang
Glad the grep command worked for you!
Did you have any more questions or are we okay to close this thread?
Re: Seperately identify the Active and Passive check service
Posted: Mon Jan 29, 2018 10:48 pm
by yosh
Hi
@kyang,
Thats all for now. We can close the thread.
Thanks again for your great help.
Re: Seperately identify the Active and Passive check service
Posted: Tue Jan 30, 2018 10:02 am
by kyang
Sounds good! I'll be closing this thread!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!