Hi.
I want to use the REST api to get and delete objects.
It works great in my testing.
At buildout, we will have hundreds of XI servers so keeping track of the individual api keys is prohibitive.
Is there a way to set the key on each XI?
Thanks,
Rick
Setting the REST API Key
Re: Setting the REST API Key
Not via the GUI directly, though you can do it in the database directly on a per-user basis:
In action:
Code: Select all
echo "UPDATE nagiosxi.xi_users SET api_key='mycoolkey' WHERE username='nagiosadmin';" | mysql -uroot -pnagiosxiCode: Select all
[root@xi-stable ~]# curl -XGET "http://192.168.67.1/nagiosxi/api/v1/objects/host?apikey=mycoolkey&pretty=1&host_name=localhost"
{
"hostlist": {
"recordcount": "1",
"host": {
"@attributes": {
"id": "143"
},
"instance_id": "1",
"host_name": "localhost",
"is_active": "1",
"config_type": "1",
"alias": "localhost",
"display_name": "localhost",
"address": "127.0.0.1",
"check_interval": "5",
"retry_interval": "1",
"max_check_attempts": "10",
"first_notification_delay": "0",
"notification_interval": "120",
"passive_checks_enabled": "1",
"active_checks_enabled": "1",
"notifications_enabled": "1",
"notes": "",
"notes_url": "",
"action_url": "",
"icon_image": "",
"icon_image_alt": "",
"statusmap_image": ""
}
}
}
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Setting the REST API Key
That worked great!
Thanks very much!
Rick
Thanks very much!
Rick
Re: Setting the REST API Key
Awesome! Would you mind if we marked this thread resolved?
Former Nagios Employee