From 9f9d60d68269d64cfa998ab697dcf81851c5fc9d Mon Sep 17 00:00:00 2001 From: "dn3250@student.uni-lj.si" Date: Tue, 6 Jan 2015 16:18:43 +0000 Subject: updated howto :) git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@155 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/snmp_agent_uptime/howtos/en/index.html | 93 +++++++++++++--------- 1 file changed, 55 insertions(+), 38 deletions(-) (limited to 'kpov_judge/tasks/snmp_agent_uptime/howtos') diff --git a/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html b/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html index b5027fa..19ffe87 100644 --- a/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html +++ b/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html @@ -120,6 +120,35 @@ +
  • + Make sure that the SNMP server reports it's uptime in seconds + over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. +
      +
    1. + create script upseconds containing this and save it where + you want:
      + #!/bin/bash
      + uptime=$(</proc/uptime)
      + seconds=${uptime%%.*}
      + echo "Uptime in seconds:" $seconds
      + exit 0
      +
    2. +
    3. + don't forget to make the script runnable:
      + command chmod +x /your_path_to_script/upseconds +
    4. +
    5. + Then edit file snmpd.conf and under # EXTENDING THE AGENT + comment all three tests and add your line of your code + with upsecond script. It will look like this:
      + # extend test1 /bin/echo Hello, world!
      + # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
      + # extend-sh test3 /bin/sh /tmp/shtest
      + extend-sh "your_name" "your_path_to_script_upseconds" +
      +
    6. +
    +
  • You need to restart the snmp services.
      @@ -135,7 +164,20 @@ command snmpwalk localhost -c public -v1
    -
  • + +
  • + Also test the correct return of server's uptime in seconds SNMP under + NET-SNMP-EXTEND-MIB::nsExtendOutput2Table. +
      +
    1. + command snmpwalk -c students -v1 IPaddressOfServer + 1.3.6.1.4.1.8072.1.3.2.4.1.2 +
    2. +
    3. + it should return one strings with "Uptime in seconds: xyz" +
    4. +
    +
  • Set up of SNMPClient machine

    @@ -196,20 +238,7 @@ -
  • - Under # EXTENDING THE AGENT comment all three tests and add your script - (you'll create it later) called upminutes. -
      -
    1. - it will look like this:
      - # extend test1 /bin/echo Hello, world!
      - # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35
      - # extend-sh test3 /bin/sh /tmp/shtest
      - extend-sh "your_name" /home/test/upminutes -
      -
    2. -
    -
  • +
  • You need to restart the snmp services.
      @@ -242,9 +271,12 @@
    1. add the source code:
      - #!/bin/bash
      - echo $(awk '{print $1}' /proc/uptime) / 60 | bc
      - exit 0 + #!/bin/bash
      + uptime=$(</proc/uptime)
      + uptime=${uptime%%.*}
      + minutes=$(( uptime / 60 ))
      + echo "Uptime in minutes:" $minutes
      + exit 0
    2. don't forget to make the program runnable:
      @@ -258,7 +290,7 @@
  • As user test and create next script called beri.sh that - reads the value from the OID 1.3.6.1.4.1.8072.1.3.2.4.1.2. + reads the value from the OID 1.3.6.1.4.1.8072.1.3.2.4.1.4. on SNMPServer. Set it up on SNMPClient in the home directory of the user test.
      @@ -267,10 +299,9 @@
    1. add the source code:
      - #!/bin/bash
      - snmpwalk -c students -v1 IPaddressOfServer - 1.3.6.1.4.1.8072.1.3.2.4.1.2
      - exit 0 + #!/bin/bash
      + snmpwalk -c students -v1 IPaddressOfServer 1.3.6.1.4.1.8072.1.3.2.4.1.4
      + exit 0
    2. don't forget to make the program runnable:
      @@ -279,20 +310,6 @@
  • - -

    Testing of upminutes script

    -
      -
    1. - Make sure that the SNMP server reports it's uptime in seconds - over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table = write on - server side: -
        -
      1. - command snmpwalk -c students -v1 IPaddressOfClient - 1.3.6.1.4.1.8072.1.3.2.4.1.2 -
      2. -
      -
    2. -
    + -- cgit v1.2.1