Re: SNMP subagent in C + exec_command or similar
Fulko Hew <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <[email protected]> |
2010/5/7 Hársszegi Tibor <[email protected]> > Hi, > > have tried exec_command not much luck :( > I am trying to run scripts, like > > cat /proc/cpuinfo | grep vendor_id | awk '{print $3}' > > and similar. > No matter how I tried using SHPROC or EXECPROC (although I don't really > see SHPROC being handled at all anywhere in net-snmp) > I didn't get the pipes being executed at all. > Naturally I had to replace the command like this: > > /bin/cat /proc/cpuinfo | /usr/bin/grep vendor_id | /usr/bin/awk '{print > $3}' > > but the output was > > "processor : 0" > > so 'grep' was not taking place at all :( > Any idea how to overcome this and make sure that system() is called instead > of execv() > ? > Another thought would be: Since that command line actually had to spawn 3 sub-processes sort of daisy-chained, perhaps this might work instead (where a single sub-process is created, that then creates the daisy-chain (note: I haven't tried it, but its a simple experiment): ( /bin/cat /proc/cpuinfo | /usr/bin/grep vendor_id | /usr/bin/awk '{print $3}') Fulko ------------------------------------------------------------------------------ _______________________________________________ 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