Seperately identify the Active and Passive check services

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
yosh
Posts: 32
Joined: Tue Jan 02, 2018 11:35 pm

Seperately identify the Active and Passive check services

Post 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 ?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Seperately identify the Active and Passive check service

Post 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.
Former Nagios employee
https://www.mcapra.com/
dwhitfield
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

Post 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)
yosh
Posts: 32
Joined: Tue Jan 02, 2018 11:35 pm

Re: Seperately identify the Active and Passive check service

Post by yosh »

Hi @mcapra,

Your grep command helped me to get it done. Thanks for the knowledge sharing.
I really appreciate that.!
kyang

Re: Seperately identify the Active and Passive check service

Post by kyang »

Glad the grep command worked for you!

Did you have any more questions or are we okay to close this thread?
yosh
Posts: 32
Joined: Tue Jan 02, 2018 11:35 pm

Re: Seperately identify the Active and Passive check service

Post by yosh »

Hi @kyang,

Thats all for now. We can close the thread.

Thanks again for your great help.
kyang

Re: Seperately identify the Active and Passive check service

Post 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!
Locked