Find hosts with multiple parents, track changes
Find hosts with multiple parents, track changes
Hi,
What would be the recommended way to locate hosts with multiple parents set?
SQL query, or is there perhaps a report?
Also, is there a report (or SQL query) we can run that shows recent configuration changes (last 24h)?
With several admins making changes, it would be very useful to be able to see this.
Thanks,
Otto
What would be the recommended way to locate hosts with multiple parents set?
SQL query, or is there perhaps a report?
Also, is there a report (or SQL query) we can run that shows recent configuration changes (last 24h)?
With several admins making changes, it would be very useful to be able to see this.
Thanks,
Otto
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Find hosts with multiple parents, track changes
Hi @ottow,
You can use the API to retrieve this information. For example, the following API command will return the the configuration stored in the database for a host.
It will return json data. You can view documentation and sample commands by going to Help > API Docs > Config Reference.
Let me know if you have more questions.
You can use the API to retrieve this information. For example, the following API command will return the the configuration stored in the database for a host.
Code: Select all
curl -XGET "https://192.168.23.112/nagiosxi/api/v1/config/host?apikey=<theapikey>&host_name=localhost&pretty=1"
The audit log will provide information about changes made in the Core Configuration Manager. Go to Admin > System Information > Audit Log. We have made quite a few improvements to this log, so if you're running an old version it may not be as detailed.{
"host_name": "localhost",
"use": [
"linux-server"
],
"alias": "localhost",
"address": "127.0.0.1",
"parents": [
"192.168.23.140",
"192.168.23.142"
],
"register": "1"
}
Let me know if you have more questions.
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!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Find hosts with multiple parents, track changes
Hi,
The API call will return the data for 1 host, which is not what I am looking for.
I want to list all hosts in the system with multiple parents, presumably this needs a SQL query which I would like assistance formulating.
I'll look into the Audit Log, thanks for the info.
The API call will return the data for 1 host, which is not what I am looking for.
I want to list all hosts in the system with multiple parents, presumably this needs a SQL query which I would like assistance formulating.
I'll look into the Audit Log, thanks for the info.
Re: Find hosts with multiple parents, track changes
What he recommended should work.
You can do this:
- Change YOURXISERVER and YOURAPIKEY
Or go here and look (or copy paste into excel):
Thank you!
You can do this:
- Change YOURXISERVER and YOURAPIKEY
Code: Select all
yum install jq -y
curl -XGET -k -L --silent "http://YOURXISERVER/nagiosxi/api/v1/config/host?apikey=YOURAPIKEY&pretty=1" -k -L | jq -r '.[] | .host_name, .parents'Code: Select all
http://YOURXISERVER/nagios/cgi-bin/config.cgi?type=hostsRe: Find hosts with multiple parents, track changes
The above just produces an error:
jq: error: Cannot index string with string
jq: error: Cannot index string with string
Can I please have a SQL query instead
jq: error: Cannot index string with string
jq: error: Cannot index string with string
Can I please have a SQL query instead
Re: Find hosts with multiple parents, track changes
Please PM the output of this command to make sure it works first:
Code: Select all
curl -XGET -k -L --silent -vvv "http://YOURXISERVER/nagiosxi/api/v1/config/host?apikey=YOURAPIKEY&pretty=1"Re: Find hosts with multiple parents, track changes
API access had been disabled for some reason for the user I was testing with.
This works now, but is still less convenient and much less readable than a SQL query output.
Ref https://support.nagios.com/forum/viewto ... 16&t=59669 for what I am looking for.
This works now, but is still less convenient and much less readable than a SQL query output.
Ref https://support.nagios.com/forum/viewto ... 16&t=59669 for what I am looking for.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Find hosts with multiple parents, track changes
I can understand that is is less convenient, but as the author of the other comment, I want to chime in that not all items can be referenced from a single query like I posted in the other thread.ottow wrote:API access had been disabled for some reason for the user I was testing with.
This works now, but is still less convenient and much less readable than a SQL query output.
Ref https://support.nagios.com/forum/viewto ... 16&t=59669 for what I am looking for.
Re: Find hosts with multiple parents, track changes
I see. Thank you for this and you may close this thread.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Find hosts with multiple parents, track changes
Greatottow wrote:I see. Thank you for this and you may close this thread.
Closing thread