/zabbix/src/zabbix_server/poller/checks_snmp.c
hope this is "readable"... had not much time
i tried to connect to a snmpV2c agent to get infos out of a jvm - (nondefault port 1161)
with this patch it is possible now
Code:
diff -Bwac checks_snmp_orig.c checks_snmp.c
*** checks_snmp_orig.c 2006-06-09 08:42:12.000000000 +0200
--- checks_snmp.c 2006-06-09 08:40:56.000000000 +0200
***************
*** 85,92 ****
--- 85,94 ----
#ifdef NEW_APPROACH
snprintf(temp,sizeof(temp)-1,"%s:%d", item->ip, item->snmp_port);
session.peername = temp;
+ session.remote_port = item->snmp_port;
#else
session.peername = item->ip;
+ session.remote_port = item->snmp_port;
#endif
}
else
***************
*** 94,105 ****
#ifdef NEW_APPROACH
snprintf(temp, sizeof(temp)-1, "%s:%d", item->host, item->snmp_port);
session.peername = temp;
#else
session.peername = item->host;
#endif
}
! if( (session.version == SNMP_VERSION_1) || (item->type == ITEM_TYPE_SNMPv2c))
{
session.community = item->snmp_community;
session.community_len = strlen(session.community);
--- 96,109 ----
#ifdef NEW_APPROACH
snprintf(temp, sizeof(temp)-1, "%s:%d", item->host, item->snmp_port);
session.peername = temp;
+ session.remote_port = item->snmp_port;
#else
session.peername = item->host;
+ session.remote_port = item->snmp_port;
#endif
}
! if( (session.version == SNMP_VERSION_1) || (session.version == SNMP_VERSION_2c))
{
session.community = item->snmp_community;
session.community_len = strlen(session.community);
***************
*** 211,225 ****
zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.2");
pdu = snmp_pdu_create(SNMP_MSG_GET);
- read_objid(item->snmp_oid, anOID, &anOID_len);
-
- #if OTHER_METHODS
- get_node("sysDescr.0", anOID, &anOID_len);
- read_objid(".1.3.6.1.2.1.1.1.0", anOID, &anOID_len);
- read_objid("system.sysDescr.0", anOID, &anOID_len);
- #endif
snmp_add_null_var(pdu, anOID, anOID_len);
zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.3");
status = snmp_synch_response(ss, pdu, &response);
--- 215,224 ----
zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.2");
pdu = snmp_pdu_create(SNMP_MSG_GET);
+ snmp_parse_oid(item->snmp_oid, anOID, &anOID_len);
snmp_add_null_var(pdu, anOID, anOID_len);
+
zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 0.3");
status = snmp_synch_response(ss, pdu, &response);
***************
*** 232,241 ****
{
zabbix_log( LOG_LEVEL_DEBUG, "In get_value_SNMP() 2");
- /* for(vars = response->variables; vars; vars = vars->next_variable)
- {
- print_variable(vars->name, vars->name_length, vars);
- }*/
for(vars = response->variables; vars; vars = vars->next_variable)
{
--- 231,236 ----
***************
*** 245,253 ****
/* if( (vars->type == ASN_INTEGER) ||*/
if( (vars->type == ASN_UINTEGER)||
(vars->type == ASN_COUNTER) ||
- #ifdef OPAQUE_SPECIAL_TYPES
(vars->type == ASN_UNSIGNED64) ||
- #endif
(vars->type == ASN_TIMETICKS) ||
(vars->type == ASN_GAUGE)
)
--- 240,246 ----
i tried to connect to a snmpV2c agent to get infos out of a jvm - (nondefault port 1161)
with this patch it is possible now
Comment