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 ?
Seperately identify the Active and Passive check services
Re: Seperately identify the Active and Passive check service
You can parse status.dat for practically anything regarding how the Nagios environment looks.
Active checks enabled:
Active checks disabled:
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.
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
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
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Seperately identify the Active and Passive check service
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.mcapra wrote: Or a SQL query against the nagios database.
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
Hi @mcapra,
Your grep command helped me to get it done. Thanks for the knowledge sharing.
I really appreciate that.!
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
Glad the grep command worked for you!
Did you have any more questions or are we okay to close this thread?
Did you have any more questions or are we okay to close this thread?
Re: Seperately identify the Active and Passive check service
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!
If you have any more questions, feel free to create another thread.
Thanks for using the Nagios Support Forum!