Jump to content

Revice Printers SNMP Information


Recommended Posts

Hello,

i want to recive information about printers supplies status.

At this time i`m using snmpget,but the cpu load is very high

Does anyone have an idear how to do it ?

Thanks alot.

Link to comment
Share on other sites

Thanks for Reply,

im still have the problen that i don`t understand how to revice information from Enterprise mibs.

At this time am using snmpget like this:

Run(@ComSpec & " /c snmpget -v1 " & $sections[$i] & ' public ' &".1.3.6.1.2.1.1.1.0", @TempDir,"",6)

Then i read it with stdoutread. At last i'am closing the pid, but the problem is that is very havy to the cpu. Another Problem is that the handles will not close until i close the main exe.

Now i testet some examples like:

$wbemFlagReturnImmediately = 0x10

$wbemFlagForwardOnly = 0x20

$objLocator = ObjCreate("wbemscripting.swbemlocator")

$objServices = $objLocator.connectServer("", "root/snmp/localhost")

$objServices.security_.privileges.AddAsString("SeSecurityPrivilege")

$objSet = $objServices.ExecQuery ("SELECT * FROM SNMP_NET_DEVICE_123 WHERE hdwr_idx>1" , "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

for $obj in $objset

ConsoleWrite( "do whatever ..." & @LF)

Next

;---------------------- SNMP Action ------------------------

$wbemFlagReturnImmediately = 0x10

$wbemFlagForwardOnly = 0x20

$objLocator = ObjCreate("wbemscripting.swbemlocator")

$objServices = $objLocator.connectServer("", "root/snmp/localhost")

$objServices.security_.privileges.AddAsString("SeSecurityPrivilege")

$obj= $objServices.Get("SNMP_NET_DEVICE_123=@")

$obj.deviceLocation = "40/5073"

$obj.put_

_________________________________________________________________________

Or:

#include <GUIConstants.au3>

$IP = "127.0.0.1"

$hwnd = GUICreate ("MIB Data Viewer", 800, 600)

$edit1 = GUICtrlCreateEdit ("", 0, 0, 800, 600)

GUICtrlSetBkColor (-1, 0x000000)

GUICtrlSetColor ($edit1, 0xFFFFFF)

UDPStartup()

$socket = UDPBind($IP, 161)

If @error = 1 Then MsgBox(0, "error", "Incorrect IP")

If @error = 2 Then MsgBox(0, "error", "Incorrect port")

MsgBox(0, "error", @error)

GUISetState (@SW_SHOW)

While 1

$msg = GUIGetMsg ()

$data = UDPRecv($socket, 256)

If $data <> "" Then

GUICtrlSetData ($edit1, GUICtrlRead ($edit1) & @CRLF & _

"------------------------------------------------------------------------------------------" & _

@CRLF & $data)

EndIf

Select

Case $msg = $GUI_EVENT_CLOSE

Exit

EndSelect

WEnd

Func OnAutoItExit()

UDPCloseSocket($socket)

UDPShutdown()

EndFunc

But the problem is that nothing works and i don`t know how to get the information that i want like the value of: .1.3.6.1.2.1.1.1.0

I`m searching since 4 weeks an nowbody has an Idea how to to it :)

Thanks @all

Link to comment
Share on other sites

@boodo

You can't expect just to copy and past some code and this to work as expected.

First try to understand what your are asking :

- read about SNMP protocol

- Read about MIB's

If I see the time available I will post some examples in the Example section of the forum.

No guarantees though.

regards,

ptrex

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...