command to show me all my hosts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

command to show me all my hosts

Post by DOkuwa »

command to show me all my hosts
is there any command to show me all the hosts in my Nagios core server 3.x
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: command to show me all my hosts

Post by mcapra »

I think this should work in Core 3 though I haven't tested it:

Code: Select all

grep -A 1 'hoststatus' /usr/local/nagios/var/status.dat
You may need to change the path depending on where your status.dat is located. Also the Nagios Core daemon must be running for this to work correctly.

In action:

Code: Select all

[root@nagios ~]# grep -A 1 'hoststatus' /usr/local/nagios/var/status.dat
hoststatus {
        host_name=esprod00
--
hoststatus {
        host_name=esprod01
--
hoststatus {
        host_name=esprod02
--
hoststatus {
        host_name=esprod03
Former Nagios employee
https://www.mcapra.com/
kyang

Re: command to show me all my hosts

Post by kyang »

Thanks @mcapra!

@DOkuwa, did this help you?
DOkuwa
Posts: 114
Joined: Tue Aug 15, 2017 3:54 pm

Re: command to show me all my hosts

Post by DOkuwa »

Thanks it worked
kyang

Re: command to show me all my hosts

Post by kyang »

Sounds great! I'll be closing this topic as resolved!

If you have any more questions, feel free to create another thread!

Thank you for using the Nagios Support Forum!
Locked