From: serassio <> Date: Sun, 14 May 2006 15:22:35 +0000 (+0000) Subject: Bug #1347: Modify squid MIB to incorporate squid.conf visible_hostname X-Git-Tag: SQUID_3_0_PRE4~135 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47a723286aec896b6dd6a388ad45b582265c6eaa;p=thirdparty%2Fsquid.git Bug #1347: Modify squid MIB to incorporate squid.conf visible_hostname Patch provided by John Horne, thanks ! --- diff --git a/include/cache_snmp.h b/include/cache_snmp.h index 714131c2dc..32ded68a2e 100644 --- a/include/cache_snmp.h +++ b/include/cache_snmp.h @@ -1,5 +1,5 @@ /* - * $Id: cache_snmp.h,v 1.27 2003/01/23 00:36:47 robertc Exp $ + * $Id: cache_snmp.h,v 1.28 2006/05/14 09:22:35 serassio Exp $ */ #ifndef SQUID_CACHE_SNMP_H @@ -79,6 +79,7 @@ enum { CONF_VERSION_ID, CONF_LOG_FAC, CONF_STORAGE, + CONF_UNIQNAME, CONF_END }; diff --git a/src/mib.txt b/src/mib.txt index 1f3ea9afb9..cc41a5194d 100644 --- a/src/mib.txt +++ b/src/mib.txt @@ -2,7 +2,7 @@ SQUID-MIB DEFINITIONS ::= BEGIN -- --- $Id: mib.txt,v 1.28 2003/05/02 09:57:54 hno Exp $ +-- $Id: mib.txt,v 1.29 2006/05/14 09:22:35 serassio Exp $ -- IMPORTS @@ -152,6 +152,15 @@ squid MODULE-IDENTITY -- end of cacheStorageConfig group + cacheUniqName OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + " Cache unique host name " + ::= { cacheConfig 6 } + + -- -- performance group { squid 3 } -- diff --git a/src/snmp_agent.cc b/src/snmp_agent.cc index 96b66be708..736b4b7807 100644 --- a/src/snmp_agent.cc +++ b/src/snmp_agent.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_agent.cc,v 1.91 2005/04/18 21:52:43 hno Exp $ + * $Id: snmp_agent.cc,v 1.92 2006/05/14 09:22:35 serassio Exp $ * * DEBUG: section 49 SNMP Interface * AUTHOR: Kostas Anagnostakis @@ -161,6 +161,19 @@ snmp_confFn(variable_list * Var, snint * ErrP) break; + case CONF_UNIQNAME: + Answer = snmp_var_new(Var->name, Var->name_length); + + cp = uniqueHostname(); + + Answer->type = ASN_OCTET_STR; + + Answer->val_len = strlen(cp); + + Answer->val.string = (u_char *) xstrdup(cp); + + break; + default: *ErrP = SNMP_ERR_NOSUCHNAME; diff --git a/src/snmp_core.cc b/src/snmp_core.cc index 4870fb3d26..3e05098efb 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.73 2005/12/26 11:35:22 serassio Exp $ + * $Id: snmp_core.cc,v 1.74 2006/05/14 09:22:35 serassio Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -127,7 +127,7 @@ snmpInit(void) snmpAddNode(snmpCreateOid(LEN_SYS, SQ_SYS, SYS_UPTIME), LEN_SYS, snmp_sysFn, static_Inst, 0)), snmpAddNode(snmpCreateOid(LEN_SQ_CONF, SQ_CONF), - LEN_SQ_CONF, NULL, NULL, 5, + LEN_SQ_CONF, NULL, NULL, 6, snmpAddNode(snmpCreateOid(LEN_SYS, SQ_CONF, CONF_ADMIN), LEN_SYS, snmp_confFn, static_Inst, 0), snmpAddNode(snmpCreateOid(LEN_SYS, SQ_CONF, CONF_VERSION), @@ -145,7 +145,9 @@ snmpInit(void) snmpAddNode(snmpCreateOid(LEN_CONF_ST, SQ_CONF, CONF_STORAGE, CONF_ST_SWHIWM), LEN_CONF_ST, snmp_confFn, static_Inst, 0), snmpAddNode(snmpCreateOid(LEN_CONF_ST, SQ_CONF, CONF_STORAGE, CONF_ST_SWLOWM), - LEN_CONF_ST, snmp_confFn, static_Inst, 0))), + LEN_CONF_ST, snmp_confFn, static_Inst, 0)), + snmpAddNode(snmpCreateOid(LEN_SYS, SQ_CONF, CONF_UNIQNAME), + LEN_SYS, snmp_confFn, static_Inst, 0)), snmpAddNode(snmpCreateOid(LEN_SQ_PRF, SQ_PRF), LEN_SQ_PRF, NULL, NULL, 2, snmpAddNode(snmpCreateOid(LEN_SQ_PRF + 1, SQ_PRF, PERF_SYS),