Page 1 of 1

Automated Host Management for MRTG services?

Posted: Tue Nov 28, 2017 4:16 pm
by DFaught
I have been building towards using the processes in the Automated Host Management document in the Nagios XI Administrator Guide, but it looks like services for network routers and switches that use MRTG checks require some other process. How can I automate that MRTG process in a similar manner?

Re: Automated Host Management for MRTG services?

Posted: Wed Nov 29, 2017 11:49 am
by kyang
There's really no way to do this with routers/switches easily.

If they are almost similar then you could probably script the mrtg files and then it maybe would work.

Otherwise, the easiest and quickest way is to just run the wizard each time.

Re: Automated Host Management for MRTG services?

Posted: Mon Dec 11, 2017 12:08 pm
by DFaught
Running the wizard each time is not an automated solution. Also I noticed that when a host and its related services are deleted, either using automation or with CCM, that the MRTG files are not also deleted. In my view that is a product bug that should be fixed.

Re: Automated Host Management for MRTG services?

Posted: Mon Dec 11, 2017 1:05 pm
by mcapra
DFaught wrote:Running the wizard each time is not an automated solution.
True, but in lieu of a proper solution stuff like PhantomJS and Selenium exists to tackle automating "the running of the wizards". Hardly ideal, but if it were my problem to solve that's how I'd do it. You'd need some sort of queuing/chunking mechanism to prevent thrashing the CCM and command subsystem though.
DFaught wrote:Also I noticed that when a host and its related services are deleted, either using automation or with CCM, that the MRTG files are not also deleted. In my view that is a product bug that should be fixed.
Part of this is a general disconnect between Configuration Wizards and the Core Config Manager. Step 1 is introducing functionality by which the CCM could identify objects installed via configuration wizards. Step 2 would be having "roll/unroll" or "install/uninstall" style steps included for each config object created by a config wizard (a sort of "uninstall/remove object" function in the wizard itself?). This would be better than a bolt-on "just MRTG stuff" fix because I know there's other wizards with such obstacles (WebInject comes to mind).

Though a non-trivial problem to solve for sure, I think this would be good functionality and isn't terribly far-fetched in the age of "infrastructure as code".

Re: Automated Host Management for MRTG services?

Posted: Mon Dec 11, 2017 1:50 pm
by DFaught
Thank you for your reply. I have already built a Selenium-like solution (using Katalon Studio) but it does not solve the 2nd issue of the MRTG bits left lying around. Now I am looking at the long-term effects and maintainability of the web driver solution versus the "automation" approach. Neither is ideal.

Re: Automated Host Management for MRTG services?

Posted: Mon Dec 11, 2017 3:52 pm
by kyang
Thanks @mcapra,

DFaught, There is currently a feature request in the works for "deleting a Host will delete the /etc/mrtg/conf.d/ cfg file".

Re: Automated Host Management for MRTG services?

Posted: Wed Jan 03, 2018 9:11 am
by DFaught
The more I look at this, the less I like it. Defining new hosts and related services for network switches/routers using the wizard does not allow for the possibility of using CCM templates for those hosts and services because this process fills in everything in the host or service configuration, overriding anything that might be specified in a related CCM template.

On the other hand, defining new hosts and related services using CCM and/or the process described in the Automated Host Management document does not allow building a network switch/router configuration that uses the MRTG data collection method.

I am trying to build an enterprise-class monitoring solution including hundreds of network devices and thousands of related services that is maintainable by others in a relatively vanilla fashion. What is the best way to accomplish that?

Thanks for any reasonable suggestions.

Re: Automated Host Management for MRTG services?

Posted: Wed Jan 03, 2018 3:11 pm
by kyang
As of now, there is no way to do so with our wizard for MRTG services since it uses check_rrdtraf.

You could take a look at other plugins to accomplish this. (Creates MRTG services in a tmp directory or you can specify one in the plugin.) In line 143-ish in the plugin. my $TRAFFIC_FILE is the variable, if not it creates a tmp file to store MTRG data if it doesn't exist.

https://exchange.nagios.org/directory/P ... 64/details