SNMP Subagent Programmer's Guide

Programming Tutorials
SNMP Subagent Programmer’s Guide—119728 2-71
System Time Manager
MIB
Example 2-14 shows the MIB definition used by System Time Manager. The MIB
defines only one object: systemTimeString. This scalar object is a read-write object
formatted as a string of 19 characters:
YYYY/MM/DD HH:MM:SS
YYYY designates the year, MM the month, DD the day, HH the hour, MM the minutes,
and SS the seconds. The Get and Test functions, described later in this subsection,
ensure that MIB values have this format. The Guardian procedure called in the Set
function ensures that new time values are in the following range, which is the range
allowed by the Guardian system time:
1975/01/01 00:00:00 to 4000/12/31 23:59:59
The C_ACCESS_FUNC clause of the MIB extension, which appears at the end of the
MIB definition, lets GDMOC know that the subagent provides access functions.
Example 2-14. System Time Manager MIB Definition
#include "typessmi"
SYSTEM-TIME DEFINITIONS ::= BEGIN
IMPORTS
OBJECT-TYPE
FROM RFC-1212
DisplayString
FROM RFC1213-MIB;
private OBJECT IDENTIFIER ::= { iso(1) org(3) dod(6) internet(1) 4 }
enterprises OBJECT IDENTIFIER ::= { private 1 }
tandem OBJECT IDENTIFIER ::= { enterprises 169 }
nonstopsystems OBJECT IDENTIFIER ::= { tandem 3 }
snmp OBJECT IDENTIFIER ::= { nonstopsystems 155 }
snmpagent OBJECT IDENTIFIER ::= { snmp 1 }
systime OBJECT IDENTIFIER ::= { snmp 101 }
systemTimeString OBJECT-TYPE
SYNTAX DisplayString (SIZE (19))
ACCESS read-write
STATUS mandatory
DESCRIPTION
"The system's local time. GET means get current
system time; SET means set system time. GET
will always work, but subagent process must
run as SUPER group member for SET to work.
Format of time string is: ``YYYY/MM/DD HH:MM:SS''.
SET time must be in the range 1975 Jan 01
00:00:00 to 4000 Dec 31 23:59:59.999999."
::= { systime 1 }
END
EXTEND OBJECT-TYPE systemTimeString
WITH C_ACCESS_FUNC systemTimeString
IN C