diff options
Diffstat (limited to 'kpov_judge/tasks/snmp_agent_uptime/howtos')
-rw-r--r-- | kpov_judge/tasks/snmp_agent_uptime/howtos/en/index.html | 93 |
1 files changed, 55 insertions, 38 deletions
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 @@ -121,6 +121,35 @@ </ol>
</li>
<li>
+ Make sure that the SNMP server reports it's uptime in seconds
+ over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table.
+ <ol type="disc">
+ <li>
+ create script upseconds containing this and save it where
+ you want:<br>
+ <i>#!/bin/bash<br>
+ uptime=$(</proc/uptime)<br>
+ seconds=${uptime%%.*}<br>
+ echo "Uptime in seconds:" $seconds<br>
+ exit 0</i>
+ </li>
+ <li>
+ don't forget to make the script runnable:<br>
+ command <i>chmod +x /your_path_to_script/upseconds</i>
+ </li>
+ <li>
+ Then edit file <i>snmpd.conf</i> and under # EXTENDING THE AGENT
+ comment all three tests and add your line of your code
+ with upsecond script. It will look like this:<br>
+ <i># extend test1 /bin/echo Hello, world!<br>
+ # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35<br>
+ # extend-sh test3 /bin/sh /tmp/shtest<br>
+ extend-sh "your_name" "your_path_to_script_upseconds"
+ </i>
+ </li>
+ </ol>
+ </li>
+ <li>
You need to restart the snmp services.
<ol type="disc">
<li>
@@ -135,7 +164,20 @@ command <i>snmpwalk localhost -c public -v1</i>
</li>
</ol>
- </li>
+ </li>
+ <li>
+ Also test the correct return of server's uptime in seconds SNMP under
+ NET-SNMP-EXTEND-MIB::nsExtendOutput2Table.
+ <ol type="disc">
+ <li>
+ command <i>snmpwalk -c students -v1 IPaddressOfServer
+ 1.3.6.1.4.1.8072.1.3.2.4.1.2</i>
+ </li>
+ <li>
+ it should return one strings with "Uptime in seconds: xyz"
+ </li>
+ </ol>
+ </li>
</ol>
<h3>Set up of SNMPClient machine</h3>
@@ -196,20 +238,7 @@ </li>
</ol>
</li>
- <li>
- Under # EXTENDING THE AGENT comment all three tests and add your script
- (you'll create it later) called <i>upminutes</i>.
- <ol type="disc">
- <li>
- it will look like this:<br>
- <i># extend test1 /bin/echo Hello, world!<br>
- # extend-sh test2 echo Hello, world! ; echo Hi there ; exit 35<br>
- # extend-sh test3 /bin/sh /tmp/shtest<br>
- extend-sh "your_name" /home/test/upminutes
- </i>
- </li>
- </ol>
- </li>
+
<li>
You need to restart the snmp services.
<ol type="disc">
@@ -242,9 +271,12 @@ </li>
<li>
add the source code:<br>
- <i>#!/bin/bash</i><br>
- <i>echo $(awk '{print $1}' /proc/uptime) / 60 | bc</i><br>
- <i>exit 0</i>
+ <i>#!/bin/bash<br>
+ uptime=$(</proc/uptime)<br>
+ uptime=${uptime%%.*}<br>
+ minutes=$(( uptime / 60 ))<br>
+ echo "Uptime in minutes:" $minutes<br>
+ exit 0</i>
</li>
<li>
don't forget to make the program runnable:<br>
@@ -258,7 +290,7 @@ </ol>
</li>
<li>As user <i>test</i> and create next script called <i>beri.sh</i> 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.
<ol type="disc">
@@ -267,10 +299,9 @@ </li>
<li>
add the source code:<br>
- <i>#!/bin/bash</i><br>
- <i>snmpwalk -c students -v1 IPaddressOfServer
- 1.3.6.1.4.1.8072.1.3.2.4.1.2</i><br>
- <i>exit 0</i>
+ <i>#!/bin/bash<br>
+ snmpwalk -c students -v1 IPaddressOfServer 1.3.6.1.4.1.8072.1.3.2.4.1.4<br>
+ exit 0</i>
</li>
<li>
don't forget to make the program runnable:<br>
@@ -279,20 +310,6 @@ </ol>
</li>
</ol>
-
- <h3>Testing of <i>upminutes</i> script</h3>
- <ol>
- <li>
- Make sure that the SNMP server reports it's uptime in seconds
- over SNMP under NET-SNMP-EXTEND-MIB::nsExtendOutput2Table = write on
- server side:
- <ol type="disc">
- <li>
- command <i>snmpwalk -c students -v1 IPaddressOfClient
- 1.3.6.1.4.1.8072.1.3.2.4.1.2</i>
- </li>
- </ol>
- </li>
- </ol>
+
</body>
</html>
|