Page 1 of 2
NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 6:32 am
by karthek
Hi,
We need to monitor multiple XI servers.
I have seen the check_nagiosxiserver.php plugin but that seems to need a token, that is generated only when XI monitoring is added through Wizard.
We have unique admin user and password on all XI servers, but when we use the token generated from one XI on other XI server the authentication fails.
We need to automate XI monitoring process and that is why we require unique username and token that could be used across XI servers. Is there anyway we could generate this token?
Any thoughts?
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 7:51 am
by tacolover101
what is your ultimate goal to achieve when you say you'd like to monitor multiple XI servers? this may help to point you in a better direction.
then Tokens are going to change between servers by nature, since they're tokens, but they should allow you to use the plugin successfully across the board. i don't think that these are presented over the API at all, so it takes out a bit of the 'automation' possibility.
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 8:04 am
by karthek
We are trying to monitor XI servers using our (in house built) passive agent. Our agent can run scripts and send exit codes to XI servers.
Example: We would install Passive Agent on a Linux machine and monitor all our XI servers, using the plugin check_nagiosxiserver.php. Right now we need to specify seperate token for each XI. Our goal is to generate a token, that we could use to monitor all our XI servers, since we use same username.
Hope you understood.
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 8:13 am
by tacolover101
i do understand. you'd like to make the token static across the board.
i don't have XI installed currently, but from what I recall, it doesn't allow you to manually specify the token. so.... this isn't advised to modify variables at the database manually. you'll have to look at the XI database, more than likely it'll be the 'xi_users' table which has a token specified for 'nagiosadmin'. standardize that on all of your installs, and you should be good to go.
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 8:17 am
by karthek
Got it..
Is there any API calls to get the nagios daemons status?
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 8:51 am
by tacolover101
yeah - i can't recall the URL off of the top of my head. it's what the system status page calls to, to check the health on services for itself.
Re: NAGIOS XI Monitoring using Automation
Posted: Tue Sep 05, 2017 1:22 pm
by tgriep
If you go to the Help > System Reference menu, it shows an example of how to get the status on an XI server using API.
This is an example of what it looks like.
Code: Select all
http://192.168.1.1/nagiosxi/api/v1/system/status?apikey=apikey55&pretty=1
It just shows the status of the Nagios process.
If you do want to set the token on all of the servers to the same one, it can be done by editing the backend_ticket key.
The following command will set the API key to the example of 12345678 for the nagiosadmin user account. You would have to run it on all of the servers.
Code: Select all
mysql -u root -pnagiosxi nagiosxi -e "UPDATE xi_users SET backend_ticket = '12345678' WHERE username='nagiosadmin'";
Make sure the systems are backed up in case something goes wrong and you can revert back if needed.
Re: NAGIOS XI Monitoring using Automation
Posted: Wed Sep 06, 2017 5:33 am
by karthek
If you do want to set the token on all of the servers to the same one, it can be done by editing the backend_ticket key.
The following command will set the API key to the example of 12345678 for the nagiosadmin user account. You would have to run it on all of the servers.
Exactly what i was looking for. I'll test it and let you know the status.
Thank you!
Re: NAGIOS XI Monitoring using Automation
Posted: Wed Sep 06, 2017 8:34 am
by tgriep
Your Welcome.
Re: NAGIOS XI Monitoring using Automation
Posted: Wed Sep 06, 2017 8:49 am
by scottwilkerson
karthek wrote:If you do want to set the token on all of the servers to the same one, it can be done by editing the backend_ticket key.
The following command will set the API key to the example of 12345678 for the nagiosadmin user account. You would have to run it on all of the servers.
Exactly what i was looking for. I'll test it and let you know the status.
Thank you!
If you need further assistance let us know.