Customizing the metric plugin

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Customizing the metric plugin

Post by arnab.roy »

Hi Guys,

I would like to know if I can somwhow customise the metric plugin to monitor other services rather than just those fixed few items. I have been searching the plugin code to find where it grabbing the data from but so far havent had any luck! Any pointers would be really appreciated.

Many Thanks
Arnab
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Customizing the metric plugin

Post by mguthrie »

That one is going to be a bit of a trick to customize. The component relies on the backend set of functions in the file:
/usr/local/nagiosxi/html/includes/utils-metrics.inc.php

The main index.php file of the component handles the front-end aspect of it.

The dashlet html-build functions are also in the metrics.inc.php file.
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Customizing the metric plugin

Post by arnab.roy »

Hi Mike,

Thanks for the pointer after looking at the code I do understand what you meant , just want to know one last thing I can see that its doing a pattern match for the perf data. Can you tell me if I have a perfdata output of somthing looking like this "'wap-Lodge-Dorm'=1;25;30;0; 'wap TH middleKroom'=0;25;30;0; 'wap NH2'=3;25;30;0; 'wap Art Loft'=0;25;30;0; 'wap ArtPottery'=0;25;30;0; 'wap US Library CubbyHoleStacks'=1;25;30;0; " What should i be searching for ?

Cheers
Arnab
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Customizing the metric plugin

Post by mguthrie »

I don't suppose we're lucky enough that "wap" is unique to this kind of metric?
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Customizing the metric plugin

Post by arnab.roy »

Nah,,I wish ! Not at the moment but I can always manipulate the plugin so that output contains something uniq on which we can pattern match will that help ?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Customizing the metric plugin

Post by mguthrie »

Yeah, I would go that route. Have the either the plugin output or the performance data label something unique. The simpler you can keep the regular expression match the faster it will perform, that and you won't have to write such a horrible regular expression to match it.

Also, I don't think you can do a regexp match on the following:
=1;25;30;0;
, you'll get just about every set of performance data you have showing up in the results.
User avatar
arnab.roy
Posts: 354
Joined: Sat Apr 30, 2011 10:24 am

Re: Customizing the metric plugin

Post by arnab.roy »

I found out onething if you have multiple CPU for e.g and it displays it under the same service i.e. the perf graphs are cpu=1 blah blah cpu=2.... then I can I only display the first the data set with this plugin ...oh well will have to re-think what I wanted to do...

Cheers
Arnab