Hello,
I'm trying to write an extension module for snmpd, and decided to use
the pass_persist mechanism. I can get it to successfully return values
as long as they are numbers or strings (e.g. integer, string,
Counter32, DisplayString), but I cannot figure out how to return a
DateAndTime (from RFC 2579: http://tools.ietf.org/html/rfc2579 ).
The RFC indicates that DateAndTime is an octet-string of length 8 or
11. However, the pass_persist mechanism is text based - in that we
write the return value to stdout followed by a newline - so I cannot
see how it can reliably return the raw octet-string i.e. how can it
distinguish between a byte with a value 10 and the newline char? I was
hoping that I could output the DateAndTime as text in the display-hint
format (e.g. "yyyy-mm-dd,hh:mi:ss.d+00:00") but this doesn't work; the
output from smnpget is nonsense.
I have also tried writing the raw bytes to stdout, but this doesn't
seem to work either (snmpd seems to send a blank line to halt the
pass_persist script).
I'm currently testing under net-smnp 5.4.2.1, and my script is a
python 2.6 script. I will be deploying under net-snmp 5.2.3 and python
2.4.
This is the output from snmptranslate, to show you the MIB I'm using
for snmpget:
snmptranslate -m +KORDIA-FMS-WATCHDOG -IR -Tp enterprises.kordia
No log handling enabled - turning on stderr logging
Cannot find module (NET-SNMP-VACM-MIB): At line 2 in (none)
+--kordia(38086)
+--fms(1)
|
+--fmsVendors(1)
| |
| +--fmsHp(1)
| |
| +--fmsMotorola(2)
|
+--fmsWatchdog(2)
+-- -R-- EnumVal fmsWatchdogStatus(1)
| Values: ok(0), unreachable(1)
+-- -R-- Counter fmsWatchdogFailedDriverCount(2)
+-- -R-- Counter fmsWatchdogLateDriverCount(3)
|
+--fmsWatchdogDriverStatusTable(4)
|
+--fmsWatchdogDriverStatusEntry(1)
| Index: fmsWatchdogDriverIndex
|
+-- -R-- INTEGER fmsWatchdogDriverIndex(1)
+-- -R-- String fmsWatchdogDriverName(2)
| Textual Convention: DisplayString
| Size: 0..255
+-- -R-- EnumVal fmsWatchdogDriverStatus(3)
| Textual Convention: FmsWatchdogDriverStatus
| Values: ok(0), late(1), failed(2)
+-- -R-- Counter fmsWatchdogDriverDuration(4)
+-- -R-- String fmsWatchdogDriverTimestamp(5)
Textual Convention: DateAndTime
Size: 8 | 11
(I could include the MIB itself but this seems just as informative and
a lot smaller.)
How should I marshal DateAndTime values? Is there some other type I
can use instead? I see the TimeStamp type in RFC 2579, but this is the
sysUpTime value at the event time; I'd rather have an absoluate (UTC)
date and time, or some equivalent.
Alistair
------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users