Page 1 of 1

command to show me all my hosts

Posted: Wed Nov 08, 2017 5:38 am
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

Re: command to show me all my hosts

Posted: Wed Nov 08, 2017 10:41 am
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

Re: command to show me all my hosts

Posted: Wed Nov 08, 2017 11:07 am
by kyang
Thanks @mcapra!

@DOkuwa, did this help you?

Re: command to show me all my hosts

Posted: Wed Nov 08, 2017 11:27 am
by DOkuwa
Thanks it worked

Re: command to show me all my hosts

Posted: Wed Nov 08, 2017 12:20 pm
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!