Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I have been trying to setup the net-snmp to run a script remotely the same way you have explained, but when configure as you mentioned I cannot get the expected output with snmpwalk.
This is my config line:
exec .1.3.6.1.4.1.2021.50 test /bin/bash /home/sam/test.sh
I have used the example provided in the snmp.conf file itself but the problem same.
Steps
1. Entered following line in the /etc/snmp/snmp.conf file
exec .1.3.6.1.4.1.2021.50 shelltest /bin/bash /tmp/shtest
2. Created the script /tmp/shtest containing following
#!/bin/bash
echo hello world
echo hi there
exit 35
3. Ran following command
/usr/bin/snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
4. Output as follows
> /usr/bin/snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50
End of MIB
I tried this about 2 years back(older version of net-snmp) and it did work but now with new version and Fedora 7 this doesn't seems to work anymore. I am not sure whether I have missed configuring anything or some additional changes I need to perform in order to make this work. If you can help me with this it will be a great help.
Firstable you should to view if this script /tmp/shtest is running when you perform snmp query.
Just insert this line echo "123" >> /tmp/test.log, if file test.log is created so script is running.
Used the pass also but no result. Script execution rights are 755 so I don't think there is a problem in rights either. In the script I entered a echo to a file and it seem the script is not executed at all. I am really lost here and could not find anyone has got same issue. May be a silly mistake. Need to look for the root cause more.
If you can think of any reasons let me know. Thanks a lot your help in this.
Distribution: Ubuntu currently, but Fedora is my favorite
Posts: 8
Rep:
Cannot execute scripts from snmpd.conf file either
Hello,
I am having the same problem as cdivitotawela. I will attach my conf file. I have two basic scripts I would like to run for proof of concept. One is the simple echotest, and the other is just a testing script to be built on in the future.
Code:
rwcommunity public
syslocation "Intern Cube"
syscontact sam@localhost
#exec echotest /bin/echo hello world
exec testing /bin/sh /tmp/test
#these next three lines were just testing to see if the entire extensions
#was broken, or if it was just the exec command
proc snmpd
proc apache2
disk / 100000
According to the man page the oid preceding it is not necessary, but I've tried it in snmp 1 and 2 and cannot get this to work. Please let me know if you have any ideas. Thanks in advanced,
This thread is OVER TWO YEARS OLD. Please don't thread jack other people's threads too..... Search these forums and online first, and if you can not find an answer to your question, then by all means, create a new thread. Thank you for understanding.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.