Page 1 of 1
Mass import 360 switches?
Posted: Thu Nov 06, 2014 5:27 am
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
Re: Mass import 360 switches?
Posted: Thu Nov 06, 2014 1:54 pm
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.
Re: Mass import 360 switches?
Posted: Wed Nov 12, 2014 5:29 am
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?
Re: Mass import 360 switches?
Posted: Wed Nov 12, 2014 9:19 am
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
Re: Mass import 360 switches?
Posted: Wed Nov 12, 2014 5:16 pm
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.
Re: Mass import 360 switches?
Posted: Thu Nov 13, 2014 3:06 am
by WillemDH
That would probably save us some work Sam!

Thanks!
Willem
Re: Mass import 360 switches?
Posted: Thu Nov 13, 2014 1:37 pm
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).
Re: Mass import 360 switches?
Posted: Wed Dec 03, 2014 7:28 am
by WillemDH
Hey Ludmill,
Any news about this cript you were talking about?
Grtz
Re: Mass import 360 switches?
Posted: Wed Dec 03, 2014 2:59 pm
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:
Be sure to remove the .txt extension before execution is attempted
