Arduino Uno + Ethernet shield send SNMP to network printer

Arduino is completely new to me, but i want to create a program wich is able to talk to my network printer using snmp. I can't find any tutorials or examples on the net.

i've read something about agentuino, but how do i implement it in my code?
I want to see the answer of my printer in the serial monitor.
How do i send and receive a snmp command to my printer?

In iReasoning MIB browser i get the following answer:

Name/OID: sysUpTime.0; Value (TimeTicks): 1 hour 50 minutes 55 seconds (665505)
Name sysUpTime!@#.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime
OID .1.3.6.1.2.1.1.3
MIB RFC1213-MIB

Can someone please help me get started?

but i want to create a program wich is able to talk to my network printer using snmp.

Via what path? How are the Arduino statements to get to a snmp daemon? Where is that daemon running?

I want to see the answer of my printer in the serial monitor.

That's a piece of cake. The hard part, of course, is getting the answer. But, displaying it in the serial monitor is trivial.

The target (to start with) is to connect my Arduino to my router ( on wich my printer is also connected).
I want to "hard code" the SNMP "GET" function under a button. When this button is pressed the Adruino sends the request to my printer and waits for the response.
Finaly i want the answer from my printer to be displayed in the serial monitor.

@ PaulS:
What exactly do you mean with:

Via what path? How are the Arduino statements to get to a snmp daemon? Where is that daemon running?

I am completely new to Arduino, so i have no idea how i can get started.

The target (to start with) is to connect my Arduino to my router

Using an Ethernet shield and cable? Or duct tape?

I want to "hard code" the SNMP "GET" function under a button. When this button is pressed the Adruino sends the request to my printer and waits for the response.

SNMP is a protocol. There must be an application running somewhere that understands that protocol and responds accordingly. Does your router run such an application?

I am completely new to Arduino, so i have no idea how i can get started.

The key to making the Arduino a functioning member of a network is to replicate functionality that you have developed and tested on another device, such as a PC. If you can issue commands in SNMP format from an application on the PC, you can make the Arduino issue the same commands.

Until then, though, this isn't an Arduino issue.

As you can see in my first post I manage to talk to my printer via MIB browser and my PC.

In iReasoning MIB browser i get the following answer:

Name/OID: sysUpTime.0; Value (TimeTicks): 1 hour 50 minutes 55 seconds (665505)

Name sysUpTime!@#.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime
OID .1.3.6.1.2.1.1.3
MIB RFC1213-MIB

The biggest problem is, how do I use "code" in arduino so it can talk to a network device such as my printer.
implementing of buttons and LCDs come later, first I want to understand the snmp on Arduino.

For now i want to connect my Arduino + ethernet schield with my printer (or router on wich my printer is connected) by an ethernet cable.

Later on i want to build a device that reads some "predefined" parameters from a docsis cablemodem by using snmp commands. But to go for an easy start i want to request for example the sys_uptime of my printer with my arduino and display this result on the serial monitor.

The biggest problem is, how do I use "code" in arduino so it can talk to a network device such as my printer.

What code is normally used to communicate with your printer? Can you communicate with the printer using a browser or a web based page?

I made a little progress, I've got an index.htm page op the sd card of the ethernetshield. Now i use vbscript to get the snmp done.

<HTML>
    <HEAD>
    <TITLE>SNMP_Get Arduino</TITLE>
    </HEAD>
    <BODY>

    Klik op onderstaande knop om de SNMPGET procedure uit te voeren.

    <FORM NAME="Form1">

    <INPUT TYPE="Button" NAME="Button1" VALUE="SNMP_GET">

    <SCRIPT FOR="Button1" EVENT="onClick" LANGUAGE="VBScript">

    Input=InputBox("Geef het IP adres op van het netwerkelement.","Userinput","192.168.0.233")

       on error resume next
       err.clear
       strOutput = ""
       strDeviceIP = Input
       'strOutput = strOutput & strDeviceIP & vbcrlf
       strCommunity = "public"

       set objSNMP = CreateObject("OlePrn.OleSNMP")
       objSNMP.Open strDeviceIP, strCommunity, 2, 1000

       printer_hostname = objSNMP.Get(".1.3.6.1.2.1.1.5.0")
       if err.number = 0 then
          display1 = objSNMP.Get(".1.3.6.1.2.1.43.16.5.1.2.1.1")
          display2 = objSNMP.Get(".1.3.6.1.2.1.43.16.5.1.2.1.2")
          display3 = objSNMP.Get(".1.3.6.1.2.1.43.16.5.1.2.1.3")
          display4 = objSNMP.Get(".1.3.6.1.2.1.43.16.5.1.2.1.4")
          uptime = objSNMP.Get(".1.3.6.1.2.1.1.3.0")
         model = objSNMP.Get(".1.3.6.1.2.1.25.3.2.1.3.1")
          tps = 100
          tpm = tps * 60
          tph = tpm * 60
          tpd = tph * 24
          ticks = Uptime
          seconds = int(ticks/tps) mod 60
          minutes = int(ticks/tpm) mod 60
          hours = int(ticks/tph) mod 24
          days = int(ticks/tpd)
          uptime = "Uptime: " & days & " dagen," & hours & " uren," & minutes & " minuten," & seconds & " seconden."

          strOutput = strOutput & Printer_Hostname & vbcrlf & model & vbcrlf & " Display Panel:" & vbcrlf
          strOutput = strOutput & string(20,61) & vbcrlf
          strOutput = strOutput & display1 & vbcrlf & display2 & vbcrlf & _
           display3 & vbcrlf & display4 & vbcrlf
          strOutput = strOutput & string(20,61) & vbcrlf
          stroutput = uptime 'strOutput & uptime
          wscript.echo strOutput
       end if

    MsgBox strOutput

    document.write("hostname = " & printer_hostname)
    document.write("
 model = " & model)
    document.write("
 uptime = "& uptime)     
       </SCRIPT>
    </FORM>

    </BODY>
    </HTML>

I 've created a sketch where i open the index.htm page (webserver example)

    #include <SPI.h>
    #include <Ethernet.h>
    #include <SD.h>

    //toegevoegd
    EthernetClient client;
    // tot hier


    // Enter a MAC address and IP address for your controller below.
    // The IP address will be dependent on your local network:
    byte mac[] = {
     0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
    IPAddress ip(192,168,0,250);

    // Initialize the Ethernet server library
    // with the IP address and port you want to use
    // (port 80 is default for HTTP):
    EthernetServer server(80);
    File webFile;
    void setup()
    {
        Ethernet.begin(mac, ip);  // initialize Ethernet device
        server.begin();           // start to listen for clients
        Serial.begin(9600);       // for debugging
       
        // initialize SD card
        Serial.println("Initializing SD card...");
        if (!SD.begin(4)) {
            Serial.println("ERROR - SD card initialization failed!");
            return;    // init failed
        }
        Serial.println("SUCCESS - SD card initialized.");
        // check for index.htm file
        if (!SD.exists("index.htm")) {
            Serial.println("ERROR - Can't find index.htm file!");
            return;  // can't find index file
        }
        Serial.println("SUCCESS - Found index.htm file.");

    }

    void loop()
    {

        EthernetClient client = server.available();  // try to get client

        if (client) {  // got client?
            boolean currentLineIsBlank = true;
            while (client.connected()) {
                if (client.available()) {   // client data available to read
                    char c = client.read(); // read 1 byte (character) from client
                    // last line of client request is blank and ends with \n
                    // respond to client only after last line received
                    if (c == '\n' && currentLineIsBlank) {
                        // send a standard http response header
                        client.println("HTTP/1.1 200 OK");
                        client.println("Content-Type: text/html");
                        client.println("Connection: close");
                        client.println();
                        // send web page
                        webFile = SD.open("index.htm");        // open web page file
                        if (webFile) {
                            while(webFile.available()) {
                           client.write(webFile.read()); // send web page to client
                           //Serial.print(webFile.read());
                             }
                             webFile.close();
                       
                             }
                        break;

                    }
                    // every line of text received from the client ends with \r\n
                    if (c == '\n') {
                        // last character on line of received text
                        // starting new line with next character read
                        currentLineIsBlank = true;
                    }
                    else if (c != '\r') {
                        // a text character was received from client
                        currentLineIsBlank = false;
                    }
                } // end if (client.available())
            } // end while (client.connected())
            delay(1);      // give the web browser time to receive the data

            client.stop(); // close the connection
       
        } // end if (client)

    }

This gives me a html page with the following text:

    hostname = ET00200029147A
    model = 968 AIO Printer
    uptime = Uptime: 10 dagen,4 uren,51 minuten,33 seconden.

How do i get this data in my serial monitor?
Is it possible to use the html/vbscript variables in my sketch? How do i get the values out of them? (the website is on the sd card)
Maybe someone can help me integrate the html/vbscript in the sketch so it's easier to use the variables in arduino?