I had problems removing leading spaces from snmp values. I kept getting NaNs in my graphs.
I use VALUE/REGEXP in my snmp query XML.
SNMP Output:
Code: Select all
.1.3.6.1.4.1.2.3.51.1.2.20.1.5.1.1.3.1 = STRING: " 43.00 Centigrade"
Code: Select all
<source>VALUE/REGEXP: *([0-9]{1,3}\.[0-9]{1,3}).*</source>
Code: Select all
06/21/2007 03:00:39 PM - POLLER: Poller[0] Output field value: ' 43.00'
I tried various syntaxes like
Code: Select all
<source>VALUE/REGEXP: *([0-9]{1,3}\.[0-9]{1,3}).*</source>
<source>VALUE/REGEXP: +([0-9]{1,3}\.[0-9]{1,3}).*</source>
<source>VALUE/REGEXP:[ ]*([0-9]{1,3}\.[0-9]{1,3}).*</source>
<source>VALUE/REGEXP:\s+([0-9]{1,3}\.[0-9]{1,3}).*</source>
Code: Select all
if (sizeof($results) > 0) {
/* create an array keyed off of each .rrd file */
foreach ($results as $item) {
- $value = rtrim(strtr(strtr($item["output"],'\r',''),'\n',''));
+ $value = ltrim(rtrim(strtr(strtr($item["output"],'\r',''),'\n','')));
$unix_time = strtotime($item["time"]);
Is there a correct REGEXP syntax or is this a bug?
Thanks!