Hey Guys,
When I create interface traffic graphs, Cacti locks in the "Index Type" as "ifIndex" in the newly created DataSource..
How can I change this so it automatically try's to use "ifName" to find the right index?
Cheers
David
change the default indexing type
Moderators: Developers, Moderators
Hrmm I think I might have found my problem:
IF-MIB::ifName.23 = STRING: port ethernet 1/1
IF-MIB::ifName.24 = STRING: port ethernet 1/3
IF-MIB::ifName.25 = STRING: port ethernet 2/1
IF-MIB::ifName.26 = STRING: port ethernet 2/3
IF-MIB::ifName.27 = STRING: port ethernet 3/1
IF-MIB::ifName.28 = STRING: port ethernet 4/1
IF-MIB::ifName.29 = STRING: port atm-oc12 5/1
IF-MIB::ifName.30 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.31 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.32 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.33 = STRING: port atm-oc12 10/1
IF-MIB::ifName.34 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.35 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.36 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.37 = STRING: port atm-oc12 12/1
IF-MIB::ifName.38 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.39 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.40 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.41 = STRING: port atm-oc12 14/1
IF-MIB::ifName.42 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.43 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.44 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.33554432 = STRING: backbone-1
IF-MIB::ifName.33554433 = STRING: local-loopback-1
You can see that there are multiple interfaces with the same ifName, this I presume would cause cacti to ignore skip over ifName in its index order choice!
Cheers
D.
IF-MIB::ifName.23 = STRING: port ethernet 1/1
IF-MIB::ifName.24 = STRING: port ethernet 1/3
IF-MIB::ifName.25 = STRING: port ethernet 2/1
IF-MIB::ifName.26 = STRING: port ethernet 2/3
IF-MIB::ifName.27 = STRING: port ethernet 3/1
IF-MIB::ifName.28 = STRING: port ethernet 4/1
IF-MIB::ifName.29 = STRING: port atm-oc12 5/1
IF-MIB::ifName.30 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.31 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.32 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.33 = STRING: port atm-oc12 10/1
IF-MIB::ifName.34 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.35 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.36 = STRING: port atm-oc12 10/1:1
IF-MIB::ifName.37 = STRING: port atm-oc12 12/1
IF-MIB::ifName.38 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.39 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.40 = STRING: port atm-oc12 12/1:1
IF-MIB::ifName.41 = STRING: port atm-oc12 14/1
IF-MIB::ifName.42 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.43 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.44 = STRING: port atm-oc12 14/1:1
IF-MIB::ifName.33554432 = STRING: backbone-1
IF-MIB::ifName.33554433 = STRING: local-loopback-1
You can see that there are multiple interfaces with the same ifName, this I presume would cause cacti to ignore skip over ifName in its index order choice!
Cheers
D.
Last question.
Can I concatenate two fields and use that as the index?
ie ifName + ifDesc?
My equipment has the funny thing of multilayering interfaces ie
IF-MIB::ifName.29 = STRING: port atm-oc12 5/1
IF-MIB::ifName.30 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.31 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.32 = STRING: port atm-oc12 5/1:1
IF-MIB::ifDescr.29 = STRING: oc12e atm 1 port packet card, hw rev. 3, ver. 4
IF-MIB::ifDescr.30 = STRING: SONET/SDH Path
IF-MIB::ifDescr.31 = STRING: ATM Interface
IF-MIB::ifDescr.32 = STRING: AAL5 Interface
So same index yet different interface type, If I can use "IfName + IfDescr" to "find" my index then that would be awesome!
Cheers
D.
Can I concatenate two fields and use that as the index?
ie ifName + ifDesc?
My equipment has the funny thing of multilayering interfaces ie
IF-MIB::ifName.29 = STRING: port atm-oc12 5/1
IF-MIB::ifName.30 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.31 = STRING: port atm-oc12 5/1:1
IF-MIB::ifName.32 = STRING: port atm-oc12 5/1:1
IF-MIB::ifDescr.29 = STRING: oc12e atm 1 port packet card, hw rev. 3, ver. 4
IF-MIB::ifDescr.30 = STRING: SONET/SDH Path
IF-MIB::ifDescr.31 = STRING: ATM Interface
IF-MIB::ifDescr.32 = STRING: AAL5 Interface
So same index yet different interface type, If I can use "IfName + IfDescr" to "find" my index then that would be awesome!
Cheers
D.
here is a patch which looks for "+" in the oid and contatenates the two snmp return values together:
ie in interface.xml you can have:
<ifName_Descr>
<name>Name + Descr</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.31.1.1.1.1+.1.3.6.1.2.1.2.2.1.2</oid>
</ifName_Descr>
Code: Select all
diff -u data_query.php.orig data_query.php
--- data_query.php.orig 2008-04-15 06:48:26.356840000 +0300
+++ data_query.php 2008-04-15 05:23:45.795419000 +0300
@@ -222,6 +222,21 @@
}else if (($field_array["method"] == "walk") && ($field_array["direction"] == "input")) {
debug_log_insert("data_query", "Located input field '$field_name' [walk]");
+$multi_oid_field = false;
+if (preg_match("/\+/", $field_array["oid"])) {
+ $oids = split('\+', $field_array["oid"]);
+ $field_array["oid"] = $oids[0];
+ debug_log_insert("data_query", "Found multi OID field: ". $field_array["oid"] ." and ". $oids[1]);
+
+ $snmp_data_2 = array();
+ $snmp_data_2 = cacti_snmp_walk($host["hostname"], $host["snmp_community"], $oids[1],
+ $host["snmp_version"], $host["snmp_username"], $host["snmp_password"],
+ $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"],
+ $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
+
+ $multi_oid_field = true;
+}
+
$snmp_data = array();
$snmp_data = cacti_snmp_walk($host["hostname"], $host["snmp_community"], $field_array["oid"],
$host["snmp_version"], $host["snmp_username"], $host["snmp_password"],
@@ -247,6 +262,9 @@
$snmp_data[$i]["value"] = "Testing";
}
}
+if ($multi_oid_field == true) {
+ $snmp_data[$i]["value"] = $snmp_data[$i]["value"] ." ". $snmp_data_2[$i]["value"];
+}
debug_log_insert("data_query", "Found item [$field_name='" . $snmp_data[$i]["value"] . "'] index: $snmp_index [from value]");
<ifName_Descr>
<name>Name + Descr</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.31.1.1.1.1+.1.3.6.1.2.1.2.2.1.2</oid>
</ifName_Descr>
Who is online
Users browsing this forum: No registered users and 3 guests