Mass import 360 switches?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
DigNetwerk
Posts: 40
Joined: Fri Oct 25, 2013 7:29 am

Mass import 360 switches?

Post by DigNetwerk »

Hi,

I want to monitor 360 switches in Nagios and want to import them via the "Network Switch / Router Monitoring Wizard" (MRTG).

How can I automate this?

I can generate MRTG config files for each switch with a loop around the MRTG cfgmaker script. But that does not magically link them with Nagios :)

Greetings,

Michiel
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Mass import 360 switches?

Post by sreinhardt »

You are correct, that definitely wouldn't do it. Personally, I would probably create a service template, on top of the existing wizard templates, that set's 90% of what I need. Then after my script runs cfgmaker, I'd probably parse the output for what interfaces need to be added, and script the config creation from there. Finally just import them with reconfigure_nagios.sh.

You could script the webui or internal functions in another php script as well. It all depends on if you think you will need to do this again or just a one off.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
DigNetwerk
Posts: 40
Joined: Fri Oct 25, 2013 7:29 am

Re: Mass import 360 switches?

Post by DigNetwerk »

Disclaimer: I have worked with Nagios in the past, but I've forgotten a lot of it. And I have no experience with Nagios XI.

So, from your post I gather the following:

a) A service template is a script?
b) The "Network wizard" template is a service template?
c) In the case of the "Network wizard" service template it also runs the MRTG cfgmaker script?
b) After the cfgmaker script has run, some parsing of the script out happens and from that additional Nagios config is created.
e) After that reconfigure_nagios.sh needs to run. I figure this is just a "reload config" operation like you have with other daemons?

So now I understand how I can create a new Network wizard template based on the exisiting one that will save me time by setting up a few options already, the way I like them?

But how can I run this new wizard 360 times with input from say a CSV file containing switch IPs and names? Can I call this script from the command line on the Nagios server? Or via an HTTP API?
DigNetwerk
Posts: 40
Joined: Fri Oct 25, 2013 7:29 am

Re: Mass import 360 switches?

Post by DigNetwerk »

Hi,

In the mean time I talked with Willem about this and cleared up a lot of my confusion :)

We came to the conclusion that our best course of action would be to write a bash script that basically does what the Network Wizard does (I now also understand what the wizard actually does).

But using our own service and host templates (based on the templates of the wizard). This would also allow us to (if needed) add some extra logic that is not in the wizard right now and to easily run this script automatically for a batch of switches.

Greetings,
Michiel
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Mass import 360 switches?

Post by slansing »

That sounds like an awesome idea, and I could have sworn that there was a script that did something similar floating around out there. I'll try to hunt it down as it may offer some help, won't cover the XI side of things, but it will for core.
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Mass import 360 switches?

Post by WillemDH »

That would probably save us some work Sam! :D Thanks!

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Mass import 360 switches?

Post by lmiltchev »

I am not sure where Sam saw this script, but we will post it if we are able to find it. (Sam is not working today & tomorrow).
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Mass import 360 switches?

Post by WillemDH »

Hey Ludmill,

Any news about this cript you were talking about?

Grtz
Nagios XI 5.8.1
https://outsideit.net
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Mass import 360 switches?

Post by slansing »

I've had no luck digging it up so far, unfortunately. If/when you do write your script, you will want to split your devices up into separate mrtg configuration files, just take a look at how it is done currently, in XI 2014. Attached is the script that splits the mrtg configurations up to to increase performance. Standard perms are:

Code: Select all

-rwxr-xr-x root root
Be sure to remove the .txt extension before execution is attempted :)
You do not have the required permissions to view the files attached to this post.
Locked