Download SunNet Manager 2.2.3 Programmer`s Guide
Transcript
5
/* sets the debug mode to print NETMGT_DBG messages */
netmgt_debug = 1;
timeout.tv_sec = NETMGT_TIMEOUT;
timeout.tv_usec = 0;
if (gethostname(local_host, sizeof(local_host)) == -1) {
perror(“gethostname”);
exit(1);
}
(void) strcpy(event_host, local_host);
(void) strcpy(agent_host, local_host);
(void) strcpy(target, local_host);
(void) strcpy(agentname, “snmp”);
/* build set request argument */
(void) strcpy(setval.group, “system”);
(void) strcpy(setval.key,”” );
(void) strcpy(setval.name, “sysLocation”);
setval.type = NETMGT_STRING;
setval.length = strlen(location) + 1;
setval.value = location;
/* send a set request - if it succeeds, run as a callback
* RPC server waiting for the results
*/
if (!do_set_request(target, &setval, &optstring, flags, timeout))
exit(1);
/* request was verified */
svc_run();
exit(1);
5-6
SunNet Manager 2.2.3 Programmer’s Guide