Is possible add ip address to status.dat

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DonForigua
Posts: 94
Joined: Thu Oct 07, 2021 8:59 pm

Is possible add ip address to status.dat

Post 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
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Is possible add ip address to status.dat

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
DonForigua
Posts: 94
Joined: Thu Oct 07, 2021 8:59 pm

Re: Is possible add ip address to status.dat

Post 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
DonForigua
Posts: 94
Joined: Thu Oct 07, 2021 8:59 pm

Re: Is possible add ip address to status.dat

Post by DonForigua »

Or how can i get the status from the host and services from api?

thanks
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Is possible add ip address to status.dat

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
DonForigua
Posts: 94
Joined: Thu Oct 07, 2021 8:59 pm

Re: Is possible add ip address to status.dat

Post by DonForigua »

Thanks for you help

i can maka a report from api + powerbi ;)
Locked