In the support forum someone was asking if there was a possibility to readout the printer toner status using SNMP.
For those who don't know what SNMP is :
In order to retrieve data from an SNMP device you need to read the MIB database structure.
The Simple Network Management Protocol (SNMP) forms part of the internet protocol suite as defined by the Internet Engineering Task Force (IETF). SNMP is used in network management systems to monitor network-attached devices for conditions that warrant administrative attention. It consists of a set of standards for network management, including an Application Layer protocol, a database schema, and a set of data objects.
Source : http://en.wikipedia.org/wiki/Simple_Networ...gement_Protocol
For those who want to know more about MIB's :
So the key to the lock is :
A management information base (MIB) stems from the OSI/ISO Network management model and is a type of database used to manage the devices in a communications network. It comprises a collection of objects in a (virtual) database used to manage entities (such as routers and switches) in a network.
Objects in the MIB are defined using a subset of Abstract Syntax Notation One (ASN.1) called "Structure of Management Information Version 2 (SMIv2)" RFC 2578.The software that performs the parsing is a MIB compiler.
Source : http://en.wikipedia.org/wiki/Management_information_base
1. have the SNMP protocol communication = UDP 161
2. Read the MIB for the info you want to retrieve
The first thing is simple in AU3, create a UDF socket.
The second thing takes more time to dig.
Microsoft supplies by default some MIB file in your windows. Look in c:Windowssystem32 for *.MIB files
Reading them is easy. Just open them in Notepad and read.
It contains a structure of hierarchy information which was defined occording to the RFC1213 and others.
So now what ?
You can query the some MIB object using WMI.
$strTargetSnmpDevice = "10.0.0.x" ; Device IP Address $objWmiLocator = ObjCreate("WbemScripting.SWbemLocator") $objWmiServices = $objWmiLocator.ConnectServer("", "rootsnmplocalhost") $objWmiNamedValueSet = ObjCreate("WbemScripting.SWbemNamedValueSet") $objWmiNamedValueSet.Add ("AgentAddress", $strTargetSnmpDevice) $objWmiNamedValueSet.Add ("AgentReadCommunityName", "public") $colIfTable = $objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable",Default , $objWmiNamedValueSet) For $objInterface In $colIfTable ConsoleWrite ("ifIndex [Key]: " & $objInterface.ifIndex & @CRLF & _ " ifAdminStatus: " & $objInterface.ifAdminStatus & @CRLF & _ " ifDescr: " & $objInterface.ifDescr & @CRLF & _ " ifInDiscards: " & $objInterface.ifInDiscards & @CRLF & _ " ifInErrors: " & $objInterface.ifInErrors & @CRLF & _ " ifInNUcastPkts: " & $objInterface.ifInNUcastPkts & @CRLF & _ " ifInOctets: " & $objInterface.ifInOctets & @CRLF & _ " ifInUcastPkts: " & $objInterface.ifInUcastPkts & @CRLF & _ " ifInUnknownProtos: " & $objInterface.ifInUnknownProtos & @CRLF & _ " ifLastChange: " & $objInterface.ifLastChange & @CRLF & _ " ifMtu: " & $objInterface.ifMtu & @CRLF & _ " ifOperStatus: " & $objInterface.ifOperStatus & @CRLF & _ " ifOutDiscards: " & $objInterface.ifOutDiscards & @CRLF & _ " ifOutErrors: " & $objInterface.ifOutErrors & @CRLF & _ " ifOutNUcastPkts: " & $objInterface.ifOutNUcastPkts & @CRLF & _ " ifOutOctets: " & $objInterface.ifOutOctets & @CRLF & _ " ifOutQLen: " & $objInterface.ifOutQLen & @CRLF & _ " ifOutUcastPkts: " & $objInterface.ifOutUcastPkts & @CRLF & _ " ifPhysAddress: " & $objInterface.ifPhysAddress & @CRLF & _ " ifSpecific: " & $objInterface.ifSpecific & @CRLF & _ " ifSpeed: " & $objInterface.ifSpeed & @CRLF & _ " ifType: " & $objInterface.ifType & @CRLF) Next
Edited by ptrex, 14 September 2012 - 09:33 AM.