On Jul 27, 2006, at 5:56 PM, Matt Stevens wrote:

I'm writing a custom probe that's fetching some values from a machine running NET-SNMP. NET-SNMP is returning the values as strings, even though they're integers.

I'd like to graph the values (ie. PER-SECOND), but the only way I can get them to show in my probe is to use the DEFAULT type. Which then displays the values, but doesn't make them chartable.

Is there an easy way to get Intermapper to treat these values as numbers - or convert them? Doing it in NET-SNMP requires me to do quite a bit more work than the current method.

I sense there are two questions here. Your first question is how to get InterMapper to treat values as numbers so you can chart them. By default, string values are not chartable, and floating point numbers (with a decimal point) have only the integer value charted. However, in calculations, the context of the value determines how it is used...

To treat strings as numbers or chart floating point values with more precision, you need to use the "chartable" macro in your <snmp-device- display> section instead of the variable name:

 ${chartable: $str }

If you want to retain precision after the decimal point, you need to tell InterMapper the decimal format using an optional argument:

 ${chartable: #.## : $str }

The value part of the chartable macro is a full-blown expression, so you can pick apart a string using substr or unpack. e.g.

 ${chartable: substr( $str, 2) }

Your second question (possibly) is that you want to chart the deltas of the values, rather than the values themselves. To do this with string values, you need to add an extra step. You have to simulate the calculation that PER-SECOND automatically does for you.

You'll need to add some CALCULATION variables, one to store the delta, and the second to store the value of the previous/current counter and timestamp. You'll most likely get $time from sysUpTime, which is in hundreths of a second.

val_persec, ($val - $prev_val)/(($time - $prev_time) / 100), CALCULATION, "intermediate calculation"
 prev_val, $val, CALCULATION, "previous value"
 prev_time, $time, CALCULATION, "previous time"

This works because all calculation expressions are evaluated top to bottom in order, and InterMapper retains the results of all variables between polls.

Regards,

Bill Fisher
Dartware, 
LLC____________________________________________________________________
List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/
To unsubscribe: send email to: [EMAIL PROTECTED]

Reply via email to