Extending the agent using an extend script written in Python

Hamish Whittal <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi folks,

I have written a python script to be run as an extend script from
within the agent. The script runs beautifully, and returns what I want,
exiting with exit status 0. I get the extend script to run via sudo and
have tried and tested the "sudo ubc.py"

Problem now is that when I run it with a

snmpwalk vm1 .1.3.6.1.4.1.2021.51

the agent crashes. I've put it into debug mode and this is what
it returns:

  snmpd[27610]: trace: 
  snmpd[27610]: extend_load_cache(): agent/extend.c, 238: 
  snmpd[27610]: nsExtendTable:cache: 
  snmpd[27610]: load userbeancounters
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 237: 
  snmpd[27610]: run:exec: 
  snmpd[27610]: running '/usr/bin/sudo /usr/local/bin/ubc.py' 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 319: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:   waiting for child 28686... 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 331: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     calling select 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 357: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     read 8192 bytes 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 392: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     94207 left in buffer 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 331: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     calling select 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 357: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     read 0 bytes 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 365: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:     no data! 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 374: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:       child done 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 405: 
  snmpd[27610]: verbose:run:exec: 
  snmpd[27610]:   done reading 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 407: 
  snmpd[27610]: run:exec: 
  snmpd[27610]:   got 102400 bytes 
  snmpd[27610]: trace: 
  snmpd[27610]: run_exec_command(): mibgroup/utilities/execute.c, 433: 
  snmpd[27610]: run:exec: 
  snmpd[27610]:   child 28686 finished. result=0 snmpd[27610]: : /usr/bin/sudo /usr/local/bin/ubc.py
  : 0
  
An unhelpful answer would be:
	Why don't you write this in perl 
  	(because I want to write it in python)
  
I've checked, the output is in fact 8192 bytes in length. Is this too
much to return? It works with other scripts and shell scripts that I
execute, but not this python code. Any ideas why?

------------------------------------------------------------------------------
_______________________________________________
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.