From 9027451e32c0524ee9d88c570161817aa6359b10 Mon Sep 17 00:00:00 2001 From: "dn3250@student.uni-lj.si" Date: Sun, 4 Jan 2015 22:49:41 +0000 Subject: edited howto git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@145 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- .../tasks/snmp_agent_uptime/howtos/en/index.html | 137 ++++++++++++++++++--- 1 file changed, 122 insertions(+), 15 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 d51941b..b5027fa 100644 --- a/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html +++ b/kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html @@ -23,7 +23,7 @@

Write a script called beri.sh that 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 + 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.

Instructions

@@ -90,9 +90,9 @@
  • (un)comment these four lines as below:
    - # Listen for connections from the local system only
    - #agentAddress udp:127.0.0.1:161
    - # Listen for connections on all interfaces (both IPv4 *and* IPv6)
    + # Listen for connections from the local system only
    + # agentAddress udp:127.0.0.1:161
    + # Listen for connections on all interfaces (both IPv4 *and* IPv6)
    agentAddress udp:161,udp6:[::1]:161
  • @@ -136,25 +136,96 @@ - + +

    Set up of SNMPClient machine

    1. - Install snmp package on client side and tools for inspecting the - data available over SNMP. + Install snmpd and snmp packages. +
        +
      1. + command apt-get install snmpd snmp +
      2. +
      +
    2. + RECOMMENDATION! Before doing any changes to your /etc/snmp/snmpd.conf + file take a copy of original file. +
        +
      1. + command cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig +
      2. +
      +
    3. +
    4. + Set up the snmp client to allow all other computers to access it = edit + snmpd.conf file. +
        +
      1. + command nano /etc/snmp/snmpd.conf + (you can use different editor) +
      2. +
      3. + (un)comment these four lines as below:
        + # Listen for connections from the local system only
        + # agentAddress udp:127.0.0.1:161
        + # Listen for connections on all interfaces (both IPv4 *and* IPv6)
        + agentAddress udp:161,udp6:[::1]:161
        +
      4. +
      +
    5. +
    6. + Add a group (community) of computers we deem to be worthy of + accessing all data. This group will be called students = again edit + snmpd.conf file. +
        +
      1. + rocommunity students 0.0.0.0/0 +
      2. +
      3. + write correct network address = command ifconfig -a +
      4. +
      +
    7. +
    8. + OPTIONAL CONFIGURATION. Lower in the same file you can set the + location of the computer snmpd is running on and the name + of the administrator.
      1. - command apt-get install snmp snmp-mibs-downloader + find under # SYSTEM INFORMATION
      2. -
      +
  • - don't know what's next, because even snmpwalk localhost -c public -v1 - or /etc/init.d/snmp restart doesn't work.... -
  • + 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. +
      +
    1. + command /etc/init.d/snmpd restart +
    2. +
  • +
  • + You can test your configuration through localhost. +
      +
    1. + command snmpwalk localhost -c public -v1 +
    2. +
    +
  • Create the user test with password test
    1. @@ -183,9 +254,45 @@ test the program (it should output the uptime of the computer in minutes)
      command /home/test/upminutes -
    2. +
  • - +
  • 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. + on SNMPServer. Set it up on SNMPClient in the home directory of the + user test. +
      +
    1. + command nano beri.sh (you can use different editor) +
    2. +
    3. + 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 +
    4. +
    5. + don't forget to make the program runnable:
      + command chmod +x /home/test/upminutes +
    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