RE: Passing arguments to an OID with the command line tool
"PEOPLES, MICHAEL P (ATTSI)" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <C038F8186F9F1E4D8F7C0FDAB3317B12079A173E@misout7msgusr7c.ugd.att.com> |
Osimar, The crude way to handle this is to use the SNMP extensions to simply call a script that already has the required command line arguments in it. If the arguments don't vary too much, then all you would need to do is issue an snmpget to that particular OID and the script will execute. If you need different sets of arguments, then you create additional OID's for those. Here's an example (this uses the deprecated "exec" command because my implementation of this is on a Sun server with an older SNMP agent): exec .1.3.6.1.4.1.2000.255.1.1 myScript_1 /opt/myscript -s argument1 exec .1.3.6.1.4.1.2000.255.1.1 myScript_2 /opt/myscript -s argument2 exec .1.3.6.1.4.1.2000.255.1.1 myScript_3 /opt/myscript -s argument3 To call this, you execute: snmpget -c public -v 2c myhost.mydomain.com .1.3.6.1.4.1.2000.255.1.1.101.1 You should have the script echo the exit status somehow as that is what will be returned to you when this executed. You will have to parse the output of this command. The more common way to deal with this is via inittab entries or their equivalent on your operating system. You could also run a cron job every minute to check for the script. Michael Peoples Senior Systems Manager AT&T - ATTSI Office: 614-789-8559 Cell: 614-886-0923 FAX: 614-789-8975 [email protected] <mailto:[email protected]> From: Osimar Medeiros [mailto:[email protected]] Sent: Thursday, September 02, 2010 11:40 AM To: [email protected] Subject: Passing arguments to an OID with the command line tool Guys, good morning, how are you ? Sorry to jump on you like this, but I am having a problem I think you may know how to help me solving. I have a script, running on a remote server, as a daemon. And, sometimes, It crashes. Ok, so I use Nagios and SNMP to return the info when it's down, so I can access the server via SSH and restart the script. But, I know I can use Nagios's Event Handlers to do that. That it, when the script's down, Nagios runs a script ( my extend script), that uses SNMP's extend feature and it calls my script on my remote servers. Right ? The problem is: I need to pass arguments to the script. And I've been struggling here to use nsExtendArgs to do that and I have failed miserably. I saw some infos here (http://www.mail-archive.com/[email protected]/msg085 15.html), and I've got to the point of setting a value to a SNMP object. The problem is I can't set this value. Check this out: snmpset -v2c -c public -OvQ $IP NET-SNMP-EXTEND-MIB::nsExtendArgs.\"extend\" s "-s argument" Error in packet. Reason: noAccess Now, can you imagine on how I can give myself permission to write this value to that object ? Or do you know any other way to pass an argument via nsExtendArgs or nsExtendOutputFuil ? I thank you any help you can give me. Thanks a lot ! []'s Osimar Medeiros TI ---------------------------------------------------------- VIRID Interatividade Digital www.virid.com.br Phone: +55 11 4084-5099 ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ 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