Metrics Component
Metrics Component
Before I copy the metrics component and highly modify for my(and anyone else who wants it) use, is any work being done on it that I should wait on? I have to make it more useful and able to manage more perf data and also make a few adjustments to the metric gauge dashlet. I just don't want to double up work that Nagios could already be doing.
If not, then I'm diving head first into this.
If not, then I'm diving head first into this.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: Metrics Component
In this thread, it seems like some developer is working to improve the Metrics component: http://support.nagios.com/forum/viewtop ... t=+metrics I made feature request to improve it some time ago http://tracker.nagios.com/view.php?id=471 and there also should be an internal feature request (TASK ID 3372).
Grtz
Willem
Grtz
Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Metrics Component
Yeah, I need this like yesterday, so I think I am going to attempt tackling this myself.
Just so you know what I am doing:
Just so you know what I am doing:
- Adding ability to work with other memory and CPU checks
- Adding ability to remove the label on the dashlet from the gauges tab
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: Metrics Component
If you updated the component to deal with more real world output syntax and share it, you deserve a medal. There is indeed a few feature requests, but we have not moved on them. (though we are just a week or two away from possibly entering a maint window on our products - with the goal of cleaning up tracker!)BanditBBS wrote:Those are two of the biggest changes I need to do.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Metrics Component
It's on the "longer term" to-do list, so nobody has been actively working on it recently. However, we'd love to hear more of your ideas for it, and if you are struggling with a specific portion of what you want to add we can definitely help you out and work it into the current component!
Re: Metrics Component
I'm basically going to add a second memory and second CPU selection. That is what I am going to do immediately and will share the code changes with Nagios in case you want to incorporate into production.slansing wrote:It's on the "longer term" to-do list, so nobody has been actively working on it recently. However, we'd love to hear more of your ideas for it, and if you are struggling with a specific portion of what you want to add we can definitely help you out and work it into the current component!
UGH - Sure wish I understood php better...at least as well as I understand bash and perl. Not having fun with this. If anyone on the forums understands php very well and wants to spend a few minutes today helping me...let me know!
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: Metrics Component
I might be able to help out with this. What specifically did you mean by adding a second CPU and memory selection? Just the Metric dropdown having (for example) CPU Usage Long and Memory Usage Long? What would you want them to display that is different from the current CPU and memory displays?
Former Nagios employee
Re: Metrics Component
Holy *Beep*!
I somehow hacked at it enough to get what I want for now!
Change
to
remark out lines
In /usr/local/nagiosxi/html/includes/utils-metrics.inc.php
add/modify this code:(lines numbers may not be exactly the same for you)
I somehow hacked at it enough to get what I want for now!
- To remove the "details" column in metrics(optional):
Change
Code: Select all
<tr><th>'.gettext('Host').' </th><th>'.gettext('Service').' </th><th><div style="width: 160px; height: 1px;">'.get_metric_value_description($ metric).'</div> </th><th>'.gettext('Details').' </th></tr>Code: Select all
<tr><th>'.gettext('Host').' </th><th>'.gettext('Service').' </th><th><div style="width: 160px; height: 1px;">'.get_metric_value_descrip tion($metric).'</div> </th></tr>Code: Select all
$output.='<td>';
$output.=$arr["output"];
$output.='</td>';- To display CPU and Memory metrics for perfdata that looks like this:
Code: Select all
CpuUser=15.81%;90;95;0; CpuSystem=1.40%;90;95;0; CpuIowait=0.00%;90;95;0; CpuIdle=82.79%;0;0;0; CpuNice=0.00%;0;0;0; CpuSteal=0.00%;0;0;0;
TOTAL=16336836KB;;;; USED=830808KB;13069468;14703152;; FREE=15506028KB;;;; CACHES=5699240KB;;;;add/modify this code:(lines numbers may not be exactly the same for you)
Code: Select all
179 case "cpu-ld":
180 if (preg_match("/Idle/", $perfdata) > 0) // Linux
181 return true;
182 break;
183 case "memory-tuf":
184 if (preg_match("/USED/", $perfdata) > 0) // Linux
185 return true;
186 break;
Code: Select all
260 case "cpu-ld":
261 if (preg_match("/Idle/", $perfdata) > 0) { // NSClient++;
262 metrics_split_perfdata($perfdata, $current, $uom, $warn, $crit, $min, $max, $sortval, $displayval, "%", $metric);
263 return true;
264 }
265 break;
266 case "memory-tuf":
267 if (preg_match("/USED/", $perfdata) > 0) { // NSClient++;
268 metrics_split_perfdata($perfdata, $current, $uom, $warn, $crit, $min, $max, $sortval, $displayval, "%", $metric);
269 return true;
270 }
271 break;
Code: Select all
309 $perfpartsc = explode(";", $perfpartsa[2]);
310 $perfpartsd = explode(";", $perfpartsa[3]);
Code: Select all
331 case "cpu-ld":
332 $cpuuser = floatval(grab_array_var($perfpartsb, 0, 0));
333 $cpusystem = floatval(grab_array_var($perfpartsc, 0, 0));
334 $cpuiowait = floatval(grab_array_var($perfpartsd, 0, 0));
335 $warn = floatval(grab_array_var($perfpartsb, 1, 0));
336 $crit = floatval(grab_array_var($perfpartsb, 2, 0));
337 $usage = number_format(($cpuuser + $cpusystem + $cpuiowait), 1);
338 break;
339 case "memory-tuf":
340 $current = floatval(grab_array_var($perfpartsc, 0, 0));
341 $uom = "";
342 $warn = floatval(grab_array_var($perfpartsc, 1, 0));
343 $crit = floatval(grab_array_var($perfpartsc, 2, 0));
344 $min = floatval(grab_array_var($perfpartsb, 3, 0));
345 $max = floatval(grab_array_var($perfpartsb, 0, 0));
346 $usage = number_format(100-(($max - $current) / $max * 100), 1);
347 break;
Code: Select all
396 $metrics = array(
397 "disk" => "Disk Usage",
398 "cpu" => "CPU Usage",
399 "cpu-ld" => "CPU Usage - Linux Detail",
400 "memory" => "Memory Usage",
401 "memory-tuf" => "Memory Usage - T/U/F",
402 "load" => "Load",
403 "swap" => "Swap",
404 );
405
406 return $metrics;
407 }
408
409 /**
410 * @param $name
411 *
412 * @return string
413 */
414 function get_metric_value_description($name)
415 {
416
417 $metrics = array(
418 "disk" => "% Utilization",
419 "cpu" => "% Utilization",
420 "cpu-ld" => "% Utilization",
421 "memory" => "% Utilization",
422 "memory-tuf" => "% Utilization",
423 "load" => "Load",
424 "swap" => "Swap Utilization",
425 );
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
Re: Metrics Component
This is what part of my customer's dashboard is looking like now with the changes...buh-bye nagvis! (well, once I get another dashlet working)
You do not have the required permissions to view the files attached to this post.
2 of XI5.6.14 Prod/DR/DEV - Nagios LogServer 2 Nodes
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
See my projects on the Exchange at BanditBBS - Also check out my Nagios stuff on my personal page at Bandit's Home and at github
- snapon_admin
- Posts: 952
- Joined: Mon Jun 10, 2013 10:39 am
- Location: Kenosha, WI
- Contact:
Re: Metrics Component
Ok, my interest has officially been piqued...