using API to add Router and Switchs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
elade
Posts: 144
Joined: Wed Mar 28, 2018 6:23 am

using API to add Router and Switchs

Post 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?
bolson

Re: using API to add Router and Switchs

Post 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!
elade
Posts: 144
Joined: Wed Mar 28, 2018 6:23 am

Re: using API to add Router and Switchs

Post by elade »

Hi bolson,

And how I create the rrd file?
bolson

Re: using API to add Router and Switchs

Post 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.
elade
Posts: 144
Joined: Wed Mar 28, 2018 6:23 am

Re: using API to add Router and Switchs

Post 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)?
bolson

Re: using API to add Router and Switchs

Post 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!
bolson

Re: using API to add Router and Switchs

Post by bolson »

Hello again elade,

Did you mean the fusekey as you stated in your question, or the API key?
elade
Posts: 144
Joined: Wed Mar 28, 2018 6:23 am

Re: using API to add Router and Switchs

Post by elade »

Hi bolson ,

I meant fusekey
bolson

Re: using API to add Router and Switchs

Post by bolson »

Great.

May we go ahead and lock this thread?
elade
Posts: 144
Joined: Wed Mar 28, 2018 6:23 am

Re: using API to add Router and Switchs

Post by elade »

Yes thank you
Locked