Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting a random number from a shell script and store it in to a file using snmpcommad (SNMP Protocol)
    primarykey
    data
    text
    <p>I am facing issue with running a script through snmpwalk command which should redirect a random number into a output file:</p> <p>I have configured OID for script in snmpd.conf undet /etc/snmp/ as exec .1.3.6.1.4.1.99.1.53.1006 script.sh.sh /root/my_folder/script.sh</p> <hr> <p>My script is as :</p> <pre><code>#!/usr/bin/ksh Out_Path="$HOME/output.txt" echo $RANDOM &gt;&gt; $Out_Path -------------------------- </code></pre> <p>Now i am executing snmpwalk command as : snmpwalk -t 10 -v 1 -c public 127.0.0.1.1.3.6.1.4.1.99.1.53.1006 and in output file i am getting 2 random number instead of 1. I am expecting only one Random number should be present in output.txt file. Can any one explain the behavior or some solution ?</p> <hr> <p>Actual Problem :</p> <p>I am explaining what i want to achieve.I need to execute a script through snmpget command.</p> <p>Problem 1: When i use <strong>SNMPGET</strong> command then script executes and the response (internally) i am getting full (more than 1 KB) but after saving this response in a file i am doing <strong>echo $line</strong> in a while loop which will take the line of a file and as pes my expectation it should show me the whole data.(But i am able to fetch only 1 KB data )</p> <p>Problem 2: To solve problem 1 i adopt a new design which is like from 1 OID(script) i got whole data in a file.After that i am executing a new script using new OID which will fetch 1 Record(1KB) and modify the existing data and update the data.So like this i will execute second script multiple time using snmpwalk with different OID so i will get all the record.But my problem is when i am trying to update the reord(file) then in one exection it is removing 2 KB data,because of this reason i posted the question.(2 times random number in 1 snmpwalk command).</p> <p>I hope you understand the problem now but if you want some more details i will explain you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload