Page 1 of 1

Is possible add ip address to status.dat

Posted: Thu Nov 18, 2021 2:31 pm
by DonForigua
Hi

Is posiible add a ipaddress to status.dat for example

before

Code: Select all

hoststatus {                                                                                                                                           
        host_name=XXXXXXXXXXXXXXXX                                                                                                                 
        modified_attributes=0                                                                                                                          
        check_command=check-host-alive!!!!!!!!
now

Code: Select all

hoststatus {                                                                                                                                           
        host_name=XXXXXXXXXXXX   
        IP_address=1.1.1.1                                                                                                    
        modified_attributes=0                                                                                                                          
        check_command=check-host-alive!!!!!!!!
Also for servicestatus

Greetings

Re: Is possible add ip address to status.dat

Posted: Fri Nov 19, 2021 10:22 am
by benjaminsmith
Hi Don,

Thanks for contacting us. Let us know the context and I can try to suggest a workaround for you.

Nagios XI does not currently have settings to change the format of this file, so I would have to submit a feature request on this.

Regards,
Benjamin

Re: Is possible add ip address to status.dat

Posted: Mon Nov 22, 2021 11:07 am
by DonForigua
Hi dear benjaminsmith

I have a simple cron job for status in csv

For hosts

Code: Select all

cat /usr/local/nagios/var/status.dat | egrep -A 33 'hoststatus' | egrep 'host_name|current_state|plugin_output|service_description' | grep -v long_ | sed 's/host_name=//g; s/current_state=//g; s/plugin_output=//g; s/service_description=//g; s/^[[:space:]]*//' | awk '{ printf "%s,", $0 } !(NR%3) { print "" }' | sed 's/,$//g'
For services

Code: Select all

cat /usr/local/nagios/var/status.dat | egrep -A 33 'servicestatus' | egrep 'host_name|current_state|plugin_output|service_description' | grep -v long_ | sed 's/host_name=//g; s/current_state=//g; s/plugin_output=//g; s/service_description=//g; s/^[[:space:]]*//' | awk '{ printf "%s,", $0 } !(NR%4) { print "" }' | sed 's/,$//g'
But i would like have the ip address also

Re: Is possible add ip address to status.dat

Posted: Mon Nov 22, 2021 11:29 am
by DonForigua
Or how can i get the status from the host and services from api?

thanks

Re: Is possible add ip address to status.dat

Posted: Mon Nov 22, 2021 1:57 pm
by benjaminsmith
Hi,

In the GUI, go to Help > API Docs, and check out the following endpoints,
GET objects/hoststatus
GET objects/servicestatus
You'll find some example commands and you can parse the output on those.

If you'd like to submit a feature request for Nagios Core, the best place to do this is on the GitHub repository. It's an open-source product.

https://github.com/NagiosEnterprises/nagioscore/issues

Let us know if you need anything else.

--Benjamin

Re: Is possible add ip address to status.dat

Posted: Mon Nov 22, 2021 6:49 pm
by DonForigua
Thanks for you help

i can maka a report from api + powerbi ;)