Show
Ignore:
Timestamp:
11/04/09 19:26:05 (4 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1257362765 +0000
git-parent:

[64eeba69711481e6fcb2e4c6f753a2048a55ef7a]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1257362765 +0000
Message:

fixes #209

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/snmp.c

    rcf12852 r0500158  
    124124  void *sess_handle; 
    125125  noit_module_t *self; 
     126  char *target; 
    126127  eventer_t timeoutevent; 
    127128  int fd; 
     
    184185    ts->fd = -1; 
    185186    ts->refcnt = 0; 
     187    ts->target = strdup(target); 
    186188    ts->in_table = 1; 
    187189    noit_hash_store(&conf->target_sessions, 
    188                     strdup(target), strlen(target), ts); 
     190                    ts->target, strlen(ts->target), ts); 
    189191    vts = ts; 
    190192  } 
     
    790792  snmp_sess_init(&sess); 
    791793  sess.version = SNMP_VERSION_2c; 
    792   sess.peername = check->target; 
     794  sess.peername = ts->target; 
    793795  if(!noit_hash_retr_str(check->config, "community", strlen("community"), 
    794796                         &community)) { 
     
    858860  struct target_session *ts; 
    859861  struct check_info *info = check->closure; 
     862  int port = 161; 
     863  const char *portstr; 
     864  char target_port[64]; 
    860865 
    861866  info->self = self; 
     
    864869 
    865870  check->flags |= NP_RUNNING; 
    866   ts = _get_target_session(self, check->target); 
     871 
     872  if(noit_hash_retr_str(check->config, "port", strlen("port"), 
     873                        &portstr)) { 
     874    port = atoi(portstr); 
     875  } 
     876  snprintf(target_port, sizeof(target_port), "%s:%d", check->target, port); 
     877  ts = _get_target_session(self, target_port); 
    867878  gettimeofday(&check->last_fire_time, NULL); 
    868879  if(!ts->refcnt) { 
  • src/modules/snmp.xml

    rd8db299 r0500158  
    1010               default="public" 
    1111               allowed=".+">The SNMP community string providing read access.</parameter> 
     12    <parameter name="port" 
     13               required="optional" 
     14               default="161" 
     15               allowed="\d+">The UDP port to which SNMP queries will be sent.</parameter> 
    1216    <parameter name="oid_.+" 
    1317               required="optional"