Page 1 of 1
SQL Queries to DB Nagios
Posted: Sat Jun 06, 2020 11:15 am
by FCC_Nagios_Support
Hello,
What is the query to obtain hosts in a determinate hostgroup.
Thanks
Re: SQL Queries to DB Nagios
Posted: Mon Jun 08, 2020 1:51 pm
by cdienger
You can get this information from the API. To find the command you can go to Help > API Docs > Objects Reference > Group Members > objects/hostgroupmembers. The command would look something like:
Code: Select all
curl -XGET "http://XI_ADDRESS/nagiosxi/api/v1/objects/hostgroupmembers?apikey=<API_KEY>&pretty=1&hostgroup_name=HOSTGROUPNAME"
Re: SQL Queries to DB Nagios
Posted: Thu Jun 11, 2020 9:20 am
by FCC_Nagios_Support
Many Thanks Sir.
But do you now de SQL Query?
Thanks again
Re: SQL Queries to DB Nagios
Posted: Fri Jun 12, 2020 9:10 am
by ssax
WARNING: We do not recommend that you interact directly with the nagios databases. If you write to the DB directly and it causes issues it will not be supported. You should use the API whenever possible.
You can look in this file:
Code: Select all
/usr/local/nagiosxi/html/db/queries.inc.php
Search for this and you'll see the query it uses: