note 29725 added to function.snmp-get-quick-print
| From: | antic at rack1 dot php dot net | Date: | Sun, 23 Feb 2003 11:13:31 +0000 |
| Subject: | note 29725 added to function.snmp-get-quick-print | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44372@lists.php.net to get a copy of this message | ||
This can be used to parse the returned values depending on the quick print setting. For example
sysUpTime might look something like this: "Timeticks: (34575334) 4 days, 0:02:33.34", but
if quick print is enabled it will be on the form: "4:0:2:33.34". To get the same output
you can parse it differently, something like:
if(@ $sysUpTime = snmpget($switch,$community,"system.sysUpTime.0")){
if(snmp_get_quick_print()){
sscanf($sysUpTime, "%d:%d:%d:%d.%d",$day,$hour,$minute,$sec,$ticks);
$sysUpTime = "$day days, $hour:$minute:$sec.$ticks";
}else{
$sysUpTime = ereg_replace("Timeticks: \([0-9]+\) ","",$sysUpTime);
}
}
--
http://www.php.net/manual/en/function.snmp-get-quick-print.php
http://master.php.net/manage/user-notes.php?action=edit+29725
http://master.php.net/manage/user-notes.php?action=delete+29725
http://master.php.net/manage/user-notes.php?action=reject+29725