Re: running a script with a dynamic parameter
Дровалев Роман <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello. 26.11.2019 22:44, Larry Hayes пишет: > Have you tried this in your snmpd.conf file: > > exec [MIBOID] NAME PROG ARGS > > OR > > sh [MIBOID] NAME PROG ARGS > > exec and sh extensions can only be configured via the > snmpd.conf file. They cannot be set up via SNMP SET requests. > > If you look in the snmpd.conf man pages, you will find more details, > under the EXTENDING AGENT FUNCTIONALITY section. > Thanks for the answer. So, through creating your own MIB, this is not possible! Ok, Got it. I read the documentation. I ask a bad question. My task: Transfer dynamically "parameter" to agent through Net-SNMP, a script with this "parameter" should be executed on the agent. Is it possible? For example, a script has 500,000 parameters. Should I create 500,000 lines in the snmpd.conf file? With one script-parameter per line? Is there a Net-SNMP setting that allows you to pass an arbitrary parameter to a script that is not specified in advance? Thanks. Roman. > On Tue, Nov 26, 2019 at 12:50 AM Дровалев Роман > <[email protected] <mailto:[email protected]>> wrote: > > Hello. > Thanks for the quick response. I understand the script. > > How to implement this through the Net-SNMP? > 1. I am editing a file /etc/snmp/snmpd.conf > > /*pass .1.3.6.1.4.1.2021.8.4 test2 /usr/share/snmp/test2.sh*/ > > # cat test2.sh/* > #!/bin/sh > /bin/cat $1 >> /tmp/test2.new > */ > > > # /*snmpset -v3 -a SHA -A STrP@SSWRD -x AES -X STr0ngP@SSWRD -l > authPriv -u snmpadmin 10.0.2.251 .1.3.6.1.4.1.2021.8.4 s 122222*/ > UCD-SNMP-MIB::extTable.4 = STRING: "122222" > > File /*test2.new*/ is not created! That is does not work. > > 2. Is it possible to create own MIB with the implementation of > this functionality? How to make it work? > > Or is it possible to launch a script by accessing the OID only by > editing file snmpd.conf? > > Thanks. Roman. > > > 26.11.2019 3:11, Linux пишет: >> >> Is this what you are looking for? This would the content of your >> script "program". >> >> #!/bin/sh >> >> param=$1 >> >> /*snmpset -v3 -a SHA -A STrP@SSWRD -x AES -X STr0ngP@SSWRD -l >> authPriv -u snmpadmin host_ip .1.4.6.1.3.35514.4.1 s $param*/ >> >> - Ajay/**/Sharma >> >> /* >> */ >> >> On 11/25/19 4:35 AM, Дровалев Роман wrote: >>> >>> Hello. >>> >>> Tell me please. Is it possible with Net-SNMP to do the following? >>> >>> I send the command to the agent: >>> >>> /*snmpset -v3 -a SHA -A STrP@SSWRD -x AES -X STr0ngP@SSWRD -l >>> authPriv -u snmpadmin host_ip .1.4.6.1.3.35514.4.1 s "parameter #1" >>> */ >>> >>> >>> for this OID, the script "program" is executed on the agent with >>> the "parameter #1" input for this script. >>> >>> Is it possible to implement this? >>> What is the most suitable way for this? >>> >>> /"parameter #1" - this can be, for example, curl request./ >>> >>> Thanks. Roman. >>> >>> >>> >>> _______________________________________________ >>> Net-snmp-users mailing list >>> [email protected] <mailto:[email protected]> >>> Please see the following page to unsubscribe or change other options: >>> https://lists.sourceforge.net/lists/listinfo/net-snmp-users >> >> >> _______________________________________________ >> Net-snmp-users mailing list >> [email protected] <mailto:[email protected]> >> Please see the following page to unsubscribe or change other options: >> https://lists.sourceforge.net/lists/listinfo/net-snmp-users > > -- > С уважением, Дровалев Роман > Сетевой инженер ООО "Альфасатком" > > _______________________________________________ > Net-snmp-users mailing list > [email protected] > <mailto:[email protected]> > Please see the following page to unsubscribe or change other options: > https://lists.sourceforge.net/lists/listinfo/net-snmp-users > -- С уважением, Дровалев Роман Сетевой инженер ООО "Альфасатком" _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users