Changeset 0500158dc42e74f1ff76353fc2ff80cdb4ee5eb5 for src/modules
- Timestamp:
- 11/04/09 19:26:05 (4 years ago)
- git-parent:
- Files:
-
- src/modules/snmp.c (modified) (5 diffs)
- src/modules/snmp.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
src/modules/snmp.c
rcf12852 r0500158 124 124 void *sess_handle; 125 125 noit_module_t *self; 126 char *target; 126 127 eventer_t timeoutevent; 127 128 int fd; … … 184 185 ts->fd = -1; 185 186 ts->refcnt = 0; 187 ts->target = strdup(target); 186 188 ts->in_table = 1; 187 189 noit_hash_store(&conf->target_sessions, 188 strdup(target), strlen(target), ts);190 ts->target, strlen(ts->target), ts); 189 191 vts = ts; 190 192 } … … 790 792 snmp_sess_init(&sess); 791 793 sess.version = SNMP_VERSION_2c; 792 sess.peername = check->target;794 sess.peername = ts->target; 793 795 if(!noit_hash_retr_str(check->config, "community", strlen("community"), 794 796 &community)) { … … 858 860 struct target_session *ts; 859 861 struct check_info *info = check->closure; 862 int port = 161; 863 const char *portstr; 864 char target_port[64]; 860 865 861 866 info->self = self; … … 864 869 865 870 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); 867 878 gettimeofday(&check->last_fire_time, NULL); 868 879 if(!ts->refcnt) { src/modules/snmp.xml
rd8db299 r0500158 10 10 default="public" 11 11 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> 12 16 <parameter name="oid_.+" 13 17 required="optional"
