AW: SNMP AgentX Problem <LONG MAIL>
"Stefan Mikuszeit" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <F3901AB02822B34A97EDB74B8FEF9E060297369D@hom02ex.hom-de.SYZYGY.INTERN> |
Hello Dave, i have found following: if i put this line to snmpd.conf the snmpd dosn't work anymore (snmpwalk / snmpget becomes timeout): perl do '/usr/lib/net-snmp/agents/mysql_agent.pl'; Wenn i start the agent (snmpd) via the '-X' argument i have the same problem as above. The next i have found is with the /tmp/shtest that is configured in the snmpd.conf via this line: exec enterprises.ucdavis.50.100.1 /bin/sh /tmp/shtest as you can see the OID is running at enterprises.ucdavis.50.100.1, but if i make an snmpwalk i become an errormessage: root@HOM21DB:/etc/snmp# snmpwalk localhost -c public -v2c enterprises.ucdavis.50.100.1 UCD-SNMP-MIB::ucdavis.50.100.1 = No Such Object available on this agent at this OID root@HOM21DB:/etc/snmp# cat /tmp/shtest #!/bin/sh echo hello world echo hi there exit 35 with an snmpwalk at enterprises.ucdavis i find following entries in the table: UCD-SNMP-MIB::extIndex.1 = INTEGER: 1 UCD-SNMP-MIB::extIndex.2 = INTEGER: 2 UCD-SNMP-MIB::extNames.1 = STRING: enterprises.ucdavis.50.100.1 UCD-SNMP-MIB::extNames.2 = STRING: enterprises.ucdavis.50.100.1 UCD-SNMP-MIB::extCommand.1 = STRING: /bin/sh /tmp/shtest UCD-SNMP-MIB::extCommand.2 = STRING: /bin/sh /tmp/shtest UCD-SNMP-MIB::extResult.1 = INTEGER: 35 UCD-SNMP-MIB::extResult.2 = INTEGER: 35 UCD-SNMP-MIB::extOutput.1 = STRING: hello world hi there UCD-SNMP-MIB::extOutput.2 = STRING: hello world hi there UCD-SNMP-MIB::extErrFix.1 = INTEGER: noError(0) UCD-SNMP-MIB::extErrFix.2 = INTEGER: noError(0) UCD-SNMP-MIB::extErrFixCmd.1 = STRING: UCD-SNMP-MIB::extErrFixCmd.2 = STRING: It's seams that no extension is make to the table :-( Is this right, that the subagent must start before the agent is startet ? Like this: /usr/lib/net-snmp/agents/mysql_agent.pl & `which snmpd` -Ls DAEMON -Lf /var/log/snmpd.log -u root -p /var/run/snmpd.pid -X -x localhost:705 -c /etc/snmp/snmpd.conf Sorry i have forgotten to tell you that i work on an Linux Ubuntu 6.06 Server :-) I have attached the actual snmpd.conf. Regards Stefan -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]]Im Auftrag von Stefan Mikuszeit Gesendet: Dienstag, 3. Juli 2007 12:38 An: Dave Shield Cc: [email protected] Betreff: AW: SNMP AgentX Problem <LONG MAIL> Hello Dave, thx for your help :-) This is the code for set the new Value to the OID, it's included in the Script ;-) if ($next ne "") { $value = $global_status{$next}{'value'}; $request->setOID($next); $request->setValue(ASN_OCTET_STR, "$value"); The Debugging Info you will find at the attachment. Regards Stefan -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]]Im Auftrag von Dave Shield Gesendet: Dienstag, 3. Juli 2007 10:40 An: Stefan Mikuszeit Cc: [email protected] Betreff: Re: SNMP AgentX Problem <LONG MAIL> On 02/07/07, Stefan Mikuszeit <[email protected]> wrote: > The problem is that the subagent dos not submit the collected data's > to the snmp agent, but i don't no why :( Try activating the debugging code in your subagent. What does that show? What are the exact commands you are trying? I haven't looked through the whole of your code, but: > My Subagent Perlscript > > <-- SNIP --> > > #!/usr/bin/perl -- > sub mysql_snmp_handler { > if ($mode == MODE_GET) { [snip] > } > > if ($mode == MODE_GETNEXT) { [snip] > } > } > #print STDERR "- finished processing\n" if ($debugging); > } This handler doesn't seem to include and code to support SET requests - just GET and GETNEXT. So it's not too surprising that SET requests aren't working :-) Dave PS: Please don't include so much in-line information. If you've got various additional code, MIB and config files, it's probably better to include them as attachments. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ 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
snmpd.conf
(application/octet-stream, 6.2 KB)
########################################################################### # # snmpd.conf # # - created by the snmpconf configuration program # ########################################################################### # SECTION: System Information Setup # # This section defines some of the information reported in # the "system" mib group in the mibII tree. # syslocation: The [typically physical] location of the system. # Note that setting this value here means that when trying to # perform an snmp SET operation to the sysLocation.0 variable will make # the agent return the "notWritable" error code. IE, including # this token in the snmpd.conf file will disable write access to # the variable. # arguments: location_string #syslocation "Bad Homburg" # syscontact: The contact information for the administrator # Note that setting this value here means that when trying to # perform an snmp SET operation to the sysContact.0 variable will make # the agent return the "notWritable" error code. IE, including # this token in the snmpd.conf file will disable write access to # the variable. # arguments: contact_string #syscontact [email protected] # sysservices: The proper value for the sysServices object. # arguments: sysservices_number # sysservices 76 ########################################################################### # # Access Rules # ########################################################################### #### # First, map the comunity name (COMMUNITY) into a security name # (local and mynetwork, depending on where the request is coming # from): # sec.name source community com2sec local localhost secret com2sec local localhost private com2sec local localhost public com2sec mynetwork 10.43.0.0/24 secret com2sec mynetwork 10.43.0.0/24 private com2sec mynetwork 10.43.0.0/24 public com2sec mynetwork 10.42.0.0/24 secret com2sec mynetwork 10.42.0.0/24 private com2sec mynetwork 10.42.0.0/24 public #### # Second, map the security names into group names: # sec.model sec.name group MyRWGroup v1 local group MyRWGroup v2c local group MyRWGroup usm local group MyROGroup v1 mynetwork group MyROGroup v2c mynetwork group MyROGroup usm mynetwork #### # Third, create a view for us to let the groups have rights to: # incl/excl subtree mask view all included .1 view system included .iso.org.dod.internet.mgmt.mib-2.system #### # Finally, grant the 2 groups access to the 1 view with different # write permissions: # context sec.model sec.level match read write notif access MyROGroup "" any noauth exact all none none access MyRWGroup "" any noauth exact all all none ########################################################################### # SECTION: Access Control Setup # # This section defines who is allowed to talk to your running # snmp agent. # rwuser: a SNMPv3 read-write user # arguments: user [noauth|auth|priv] [restriction_oid] rwuser o2user noauth private rwuser o2user noauth public # rocommunity: a SNMPv1/SNMPv2c read-only access community name # arguments: community [default|hostname|network/bits] [oid] rocommunity public rocommunity private # rwcommunity: a SNMPv1/SNMPv2c read-write access community name # arguments: community [default|hostname|network/bits] [oid] rwcommunity private rwcommunity public ########################################################################### # SECTION: Trap Destinations # # Here we define who the agent will send traps to. # trapsink: A SNMPv1 trap receiver # arguments: host [community] [portnum] trapsink 10.42.0.84 trapsink 10.43.0.84 # trap2sink: A SNMPv2c trap receiver # arguments: host [community] [portnum] trap2sink 10.43.0.84 trap2sink 10.42.0.84 # informsink: A SNMPv2c inform (acknowledged trap) receiver # arguments: host [community] [portnum] informsink 10.43.0.84 informsink 10.42.0.84 # trapcommunity: Default trap sink community to use # arguments: community-string trapcommunity public trapcommunity private # authtrapenable: Should we send traps when authentication failures occur # arguments: 1 | 2 (1 = yes, 2 = no) authtrapenable 1 ########################################################################### # SECTION: Monitor Various Aspects of the Running Host # # The following check up on various aspects of a host. exec enterprises.ucdavis.50.100.1 /bin/sh /tmp/shtest # proc: Check for processes that should be running. # proc NAME [MAX=0] [MIN=0] # # NAME: the name of the process to check for. It must match # exactly (ie, http will not find httpd processes). # MAX: the maximum number allowed to be running. Defaults to 0. # MIN: the minimum number to be running. Defaults to 0. # # The results are reported in the prTable section of the UCD-SNMP-MIB tree # Special Case: When the min and max numbers are both 0, it assumes # you want a max of infinity and a min of 1. #proc httpd 25 1 # disk: Check for disk space usage of a partition. # The agent can check the amount of available disk space, and make # sure it is above a set limit. # # disk PATH [MIN=100000] # # PATH: mount path to the disk in question. # MIN: Disks with space below this value will have the Mib's errorFlag set. # Can be a raw byte value or a percentage followed by the % # symbol. Default value = 100000. # # The results are reported in the dskTable section of the UCD-SNMP-MIB tree disk /boot 100000 disk /data 1000000 disk /home 1000000 disk /tmp 100000 disk /usr 100000 disk /var 100000 disk / 100000 # load: Check for unreasonable load average values. # Watch the load average levels on the machine. # # load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] # # 1MAX: If the 1 minute load average is above this limit at query # time, the errorFlag will be set. # 5MAX: Similar, but for 5 min average. # 15MAX: Similar, but for 15 min average. # # The results are reported in the laTable section of the UCD-SNMP-MIB tree load 12 12 12 disablePerl false # perl do '/usr/lib/net-snmp/agents/mysql_agent.pl';