note 125881 added to class.snmp

From: Date: Fri, 05 Mar 2021 18:17:44 +0000
Subject: note 125881 added to class.snmp
Groups: php.notes 
Request: Send a blank email to php-notes+get-219135@lists.php.net to get a copy of this message
Hopefully this helps someone else out because this was driving be bonkers for a good two hours. It looks like valueretrieval and enum_print work together in a way that I wasn't expecting, and after re-reading may be by design but I'm not sure. If you can't get enums to print, this might be why. <?php $snmp = new SNMP(SNMP::VERSION_2C,'192.168.1.9','test'); $snmp->oid_output_format = SNMP_OID_OUTPUT_SUFFIX; $snmp->valueretrieval = SNMP_VALUE_PLAIN; $snmp->enum_print = 0; echo $snmp->get('IF-MIB::ifOperStatus.10110') . "\n"; $snmp->enum_print = 1; echo $snmp->get('IF-MIB::ifOperStatus.10110') . "\n"; $snmp->quick_print = 1; echo $snmp->get('IF-MIB::ifOperStatus.10110') . "\n"; $snmp->valueretrieval = SNMP_VALUE_LIBRARY; echo $snmp->get('IF-MIB::ifOperStatus.10110') . "\n"; $snmp->enum_print = 0; echo $snmp->get('IF-MIB::ifOperStatus.10110') . "\n"; ?> Output: 1 1 1 1 up ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.247 (proxied: 107.167.193.118) ---- Manual Page -- http://php.net/manual/en/class.snmp.php Edit -- https://master.php.net/note/edit/125881 Del: integrated -- https://master.php.net/note/delete/125881/integrated Del: useless -- https://master.php.net/note/delete/125881/useless Del: bad code -- https://master.php.net/note/delete/125881/bad+code Del: spam -- https://master.php.net/note/delete/125881/spam Del: non-english -- https://master.php.net/note/delete/125881/non-english Del: in docs -- https://master.php.net/note/delete/125881/in+docs Del: other reasons-- https://master.php.net/note/delete/125881 Reject -- https://master.php.net/note/reject/125881 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#219135) next »