Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

snmp_set_quick_print(boolean on)


The snmp_set_quick_print function sets the value of the UCD SNMP library's
quick_print setting. Consequently, this function is unavailable to Windows users.
See the description of snmp_get_quick_print for a brief description of the
quick_print setting.


string snmpget(string host, string community, string object,
integer timeout, integer retries)


The snmpget function returns the value of the specified object. The host may be
numerical or named. You must also specify the community and the object. Optionally,
you may supply a timeout in seconds and a number of times to retry a connection.


<?


//find out how long the system has been up
//should return something like
//Timeticks: (586731977) 67 days, 21:48:39.77
if($snmp = snmpget("ucd-snmp.ucdavis.edu",
"demopublic", "system.sysUpTime.0"))
{
print($snmp);
}
else
{
print("snmpget failed!");
}
?>


boolean snmpset(string host, string community, string object,
string type, string value, integer timeout, integer retries)


The snmpset function sets the value of the specified object. The host may be numerical
or named. You must also specify the community and the object. The type argument is a
one-character string. Table 14.12 lists valid types. Optionally, you may supply a
timeout in seconds and a number of times to retry a connection.


<?


//show current value of the demo string
$snmp = snmpget("ucd-snmp.ucdavis.edu",
"demopublic", "ucdDemoPublicString.0");
print("$snmp (original value)
\n");

Free download pdf