Page 1 of 2
using API to add Router and Switchs
Posted: Mon Dec 17, 2018 3:06 am
by elade
Hi,
I want to use the XI API to add routers and switches just like the Network Switch / Router wizard.
The API has an option to do it and not add each service one by one?
Re: using API to add Router and Switchs
Posted: Mon Dec 17, 2018 10:45 am
by bolson
Hello elade,
Duplicating the functionality of the switch router wizard via scripting with the api certainly could be done. The script would first need to perform an snpm walk to identify the ports on the switch and then loop through the results to create a service check for each port.
Hope this helps.
Thank you for visiting the Nagios Support Forum!
Re: using API to add Router and Switchs
Posted: Tue Dec 18, 2018 11:17 am
by elade
Hi bolson,
And how I create the rrd file?
Re: using API to add Router and Switchs
Posted: Tue Dec 18, 2018 12:07 pm
by bolson
My apologies elade,
For the reason you've just reminded me of (creating rrd files) I don't know if it's possible to recreate the functionality of the Switch Router Wizard with API calls. It would seem as though it likely is not. I'll continue to research this and perhaps float the idea of a feature request.
Thank you.
Re: using API to add Router and Switchs
Posted: Mon Dec 31, 2018 9:44 am
by elade
Hi bolson,
Since there is no option to add Switches and Routers via API I want to ask if there is any option to get the Fuse Key of XI using the API?
If not than i can find it anywhere on the server (centos)?
Re: using API to add Router and Switchs
Posted: Wed Jan 02, 2019 11:20 am
by bolson
Hello elade,
If you haven't changed the mysql root password, this line in a bash script will retrieve the fusekey:
Code: Select all
mysql -u root -pnagiosxi -e "use nagiosxi; select value from xi_options where name='fusekey'"
If you have changed the root password, replace nagiosxi above with the new password.
Also, please be aware that if you run the above command from the command line, the root password will be visible in your bash history.
Let us know if this resolves your issue.
Thank you for visiting the Nagios Support Forum!
Re: using API to add Router and Switchs
Posted: Wed Jan 02, 2019 11:23 am
by bolson
Hello again elade,
Did you mean the fusekey as you stated in your question, or the API key?
Re: using API to add Router and Switchs
Posted: Wed Jan 02, 2019 11:55 am
by elade
Hi bolson ,
I meant fusekey
Re: using API to add Router and Switchs
Posted: Wed Jan 02, 2019 12:06 pm
by bolson
Great.
May we go ahead and lock this thread?
Re: using API to add Router and Switchs
Posted: Thu Jan 03, 2019 2:47 am
by elade
Yes thank you