Monitor octets in a sting

classic Classic list List threaded Threaded
2 messages Options
BitnByte BitnByte
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Monitor octets in a sting

Hi

I am having problems with an octet string. I am trying to monitor the ambient on an IBM RSA II card with the OID: .1.3.6.1.4.1.2.3.51.1.2.1.5.1
The return answer is an string with this definition from IBM MIB for this RSA II card
System's ambient temperature in degrees centigrade(C).
 This is surrounding temperature where the system is installed.
 An octet string expressed as 'sddd.dd Centigrade' where:
 s is the sign ('-' for negative or blank space for positive)
 d is a decimal digit or blank space for a leading zero..
 The string 'Not Readable!' indicates that the given monitor
 is not supported on this system.

so I get the result "  20.00 Centigrade" right now but MRTG don't seem to handle it ?
(Nagios handles the return string perfect that is running om the same host as MRTG (Linux).)

My cfg looks like
# rsa-esx-shamn01 - temp - io
YLegend[rsa-esx-shamn01-temp-io]: temperature in Celsius
Options[rsa-esx-shamn01-temp-io]: growright,gauge,nopercent,absolute
Target[rsa-esx-shamn01-temp-io]: .1.3.6.1.4.1.2.3.51.1.2.1.5.1&.1.3.6.1.4.1.2.3.51.1.2.1.5.1:public@rsa-esx-shamn01
MaxBytes[rsa-esx-shamn01-temp-io]: 45
Unscaled[rsa-esx-shamn01-temp-io]: dwmy
Title[rsa-esx-shamn01-temp-io]: rsa-esx-shamn01 - ioBoard Temp
ShortLegend[rsa-esx-shamn01-temp-io]: C
Legend1[rsa-esx-shamn01-temp-io]: in next minute
Legend2[rsa-esx-shamn01-temp-io]: in next minute
Legend3[rsa-esx-shamn01-temp-io]: Maximal 5 Minute
Legend4[rsa-esx-shamn01-temp-io]: Maximal 5 Minute
LegendI[rsa-esx-shamn01-temp-io]:  
LegendO[rsa-esx-shamn01-temp-io]:  
PageTop[rsa-esx-shamn01-temp-io]:

rsa-esx-shamn01 - ioBoard temp


The log says:
2010-07-30 12:05:02 -- SNMPGET Problem for .1.3.6.1.4.1.2.3.51.1.2.1.5.1 .1.3.6.1.4.1.2.3.51.1.2.1.5.1 sysUptime sysName on public@rsa-esx-shamn01::::::v4only
 at /usr/local/mrtg-2/bin/mrtg line 2202
2010-07-30 12:05:28 -- 2010-07-30 12:05:28: ERROR: Target[rsa-esx-shamn01-temp-io][_IN_] ' $target->[0]{$mode} ' did not eval into defined data
2010-07-30 12:05:28 -- 2010-07-30 12:05:28: ERROR: Target[rsa-esx-shamn01-temp-io][_OUT_] ' $target->[0]{$mode} ' did not eval into defined data

I am using MRTG version 2.16.2

Can this be handlen within mrtg scripts or do I need an perl script to handle this string ?.
Does anyone have an solution for my issue ?

Any help is appreciated

// Daniel
Daniel McDonald Daniel McDonald
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Monitor octets in a sting

On 7/30/10 5:11 AM, "BitnByte" <[hidden email]> wrote:

>
> Hi
>
> I am having problems with an octet string. I am trying to monitor the
> ambient on an IBM RSA II card with the OID: .1.3.6.1.4.1.2.3.51.1.2.1.5.1
> The return answer is an string with this definition from IBM MIB for this
> RSA II card
> System's ambient temperature in degrees centigrade(C).
>  This is surrounding temperature where the system is installed.
>  An octet string expressed as 'sddd.dd Centigrade' where:
>  s is the sign ('-' for negative or blank space for positive)
>  d is a decimal digit or blank space for a leading zero..
>  The string 'Not Readable!' indicates that the given monitor
>  is not supported on this system.

 The usual idiom from the device manufacturers is to record the value in
integer centi-degrees, then you would use a factor[] to scale it properly.
But a string is not expected...

>
> so I get the result "  20.00 Centigrade" right now but MRTG don't seem to
> handle it ?

Correct, mrtg expects a number.  You will need to use a "conversion code"
script to make this work.  It's still a perl snippet, but the interfaces are
pretty well defined.  See the docs on this.

A sample perl sub to perform this might be:

sub tempString {
#grab  1st argument as the string to convert
    my $String = shift;
#look for optional negative sign followed by 4 to 6 digits or decimal points

    $String =~ /(-?[\.\d]{4,6})/;
    my $val = $1;
#recast as a number
    $val +=0;
#Convert to an integer
    $val *= 100;
    $val = int($val);

#return the value:
    return $val;
}

--
Daniel J McDonald, CCIE # 2495, CISSP # 78281

   

_______________________________________________
mrtg mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg
Loading...