Hi Michael,
I have made a change which, in my (brief) testing, does seem to resolve the
issue. I can no longer reproduce the issue, I am quite confident this will
fix it for you as well. I am going to submit a pull request shortly for
this, however for a short-term fix, you can just copy the affected lines
from another script (check_multiple_metrics.php has the good one).
git diff check_multiple_metrics_warn.php
diff --git a/nagios/check_multiple_metrics_warn.php
b/nagios/check_multiple_metrics_warn.php
index e7b6832..70d002f 100644
--- a/nagios/check_multiple_metrics_warn.php
+++ b/nagios/check_multiple_metrics_warn.php
@@ -61,11 +61,11 @@ if ( ! is_array( $metrics ) ) {
include_once $conf['gweb_root'] . "/get_ganglia.php";
# Massage the metrics to minimize the cache file by caching only
attributes
# we care about
- foreach ( $metrics as $host => $host_metrics ) {
+ foreach ( $metrics as $mhost => $host_metrics ) {
foreach ( $host_metrics as $name => $attributes ) {
- $new_metrics[$host][$name]['VAL'] = $metrics[$host][$name]['VAL'];
- if ( isset($metrics[$host][$name]['UNITS']) )
- $new_metrics[$host][$name]['UNITS'] =
$metrics[$host][$name]['UNITS'];
+ $new_metrics[$mhost][$name]['VAL'] = $metrics[$mhost][$name]['VAL'];
+ if ( isset($metrics[$mhost][$name]['UNITS']) )
+ $new_metrics[$mhost][$name]['UNITS'] =
$metrics[$mhost][$name]['UNITS'];
}
}
file_put_contents($conf['nagios_cache_file'], serialize($new_metrics));
Hope that helps, please feedback if you are still experiencing the issue
after updating those lines
Cheers, Michael.
On 28 November 2013 17:38, Michael Shearer <[email protected]> wrote:
> Hi Michael,
>
> I have not looked at this for a long time, but I remember encountering a
> similar issue when I worked on this. If you run it again a few seconds
> later, it is probably going to return valid metrics. However, that is not a
> very useful thing. Also, I can trigger this fairly easily, using:
>
> check_multiple_metrics_warn.sh host='hostname'
> checks='ap_busy_workers,more,1,more,2' (the values dont matter, its just a
> test).
>
> If I wait a while, run it, it will error, but if I run it again quickly
> after, it works. Seems 100% reproducible, so thats helpful. Strangely, it
> only seems to happen for "non-default" metrics. Thats is to say, metrics
> like load or cpu_idle dont display this behaviour, but apache, or extended
> disk metrics do. However, it seems like every "non-default" metric I try
> behaves this way.
>
> I cant remember what the cause of this is, possibly the loop at line 83 -
> 89? I was not the person who solved it last time I saw this, and I dont
> have the fixed code to refer to, just very hazy memories. I will see if I
> can contact someone who has acess to the (hopefully fixed) code.
>
> Cheers, Michael.
>
>
> On 28 November 2013 07:52, Michael Durket <[email protected]>wrote:
>
>> I'm testing out the Nagios plugins provided in the nagios directory of
>> Ganglia web. There's something odd going on. When I execute:
>>
>> check_ganglia_metric.sh host=<host name deleted for security>
>> metric_name=http_workers_active operator=more critical_value=100
>>
>> I get the result:
>>
>> CRITICAL http_workers_active = 117
>>
>> If I also execute:
>>
>> /var/www/html/ganglia/nagios/check_multiple_metrics_warn.sh host=<name
>> deleted> checks="http_workers_active,more,100,more,200"
>>
>> I get:
>>
>> UNKNOWN System check - No metrics returned values
>>
>> I've tried this with and without the Nagios cache enabled, but the
>> inconsistency persists.
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Rapidly troubleshoot problems before they affect your business. Most IT
>> organizations don't have a clear picture of how application performance
>> affects their revenue. With AppDynamics, you get 100% visibility into your
>> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
>> Pro!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Ganglia-general mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ganglia-general
>>
>
>
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general