Hi Everyone!
So, this is hostname in a predefined MIB:
sysName OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
An administratively-assigned name for this managed
node.
::= { system 5 }
To MY-MIB I have to write this, if I'm not mistaken:
sysHostname OBJECT-TYPE
SYNTAX DisplayString (SIZE (0..255))
MAX-ACCESS read-write
STATUS current
DESCRIPTION
sysName.0
::={sysInfo 2}
With this code I can write and read a string:
void init_ssiSchModulesT_string(void)
{
static char testText[256] = test;
oid testText_oid[] = { 1, 3, 6, 1, 4, 1, 29300, 1, 2, 0 };
netsnmp_handler_registration *reginfo;
netsnmp_watcher_info *watcher_info;
int watcher_flags;
DEBUGMSGTL((testText_instance,
Initalizing a testtext. Default value = %s\n,
testText));
reginfo = netsnmp_create_handler_registration(a testtext, NULL,
testText_oid,
OID_LENGTH(testText_oid),
HANDLER_CAN_RWRITE);
watcher_flags = WATCHER_MAX_SIZE;
watcher_info =
netsnmp_create_watcher_info(testText, strlen(testText),
ASN_OCTET_STR, watcher_flags);
watcher_info-max_size = sizeof(testText);
netsnmp_register_watched_instance(reginfo, watcher_info);
DEBUGMSGTL((testText_instance,
Done initalizing a testtext.\n));
}
What should I change in it, to tell my agent, that it should handle with the
real hostname, not with a text that I gave to it.
Dave, could you please tell me again, what to do. A little bit more detailed
would be great.
Thanks a billion!
Nikolett
Dave Shield On 03/08/07, Nikolett C [EMAIL PROTECTED] wrote:
I can now get (and also set) a string in my new MIB, but for this 'hostname'
object it is me that gives the value. I'd need the computer to give it
You're providing the code that implements this particular object.
Add code to the handler routine that deals with a request, which
retreives the 'hostname' value and returns it.
Or since this is typically fixed for the lifetime of the agent, you could
put this code in the 'init_xxx' routine, and set up a suitable variable
to hold the value. The handler routine can then simply return the
contents of this variable.
But fundamentally, you're implementing the MIB, so you can write
code to return whatever values you like.
Dave
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now http://get.splunk.com/
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now http://get.splunk.com/___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users