diff --git a/contrib/convert-mib-graphs.sh b/contrib/convert-mib-graphs.sh
new file mode 100755
index 000000000..dedc06fda
--- /dev/null
+++ b/contrib/convert-mib-graphs.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# Script to convert RRDs from the experimental first release of MIB-based polling.
+
+set -e
+set -u
+
+for i; do
+ base=${i%%.rrd}
+ mv $i $i.old
+ echo "Processing $i"
+ rrdtool dump $i.old | sed -e 's|.*|mibval|' > $base.xml
+ rrdtool restore $base.xml $i
+ rm -f $base.xml
+done
+
+exit 0
diff --git a/html/includes/graphs/device/mib.inc.php b/html/includes/graphs/device/mib.inc.php
index 08241e922..21fe1d7ee 100644
--- a/html/includes/graphs/device/mib.inc.php
+++ b/html/includes/graphs/device/mib.inc.php
@@ -16,14 +16,12 @@ $rrd_list = array();
$prefix = rrd_name($device['hostname'], array($subtype, ''), '');
foreach (glob($prefix.'*.rrd') as $filename) {
// find out what * expanded to
- $globpart = str_replace($prefix, '', $filename);
- // take off the prefix
- $instance = substr($globpart, 0, -4);
- // take off ".rrd"
+ $globpart = str_replace($prefix, '', $filename); // take off the prefix
+ $instance = substr($globpart, 0, -4); // take off ".rrd"
$ds = array();
$mibparts = explode('-', $subtype);
$mibvar = end($mibparts);
- $ds['ds'] = name_shorten($mibvar);
+ $ds['ds'] = 'mibval';
$ds['descr'] = "$mibvar-$instance";
$ds['filename'] = $filename;
$rrd_list[] = $ds;
diff --git a/includes/common.php b/includes/common.php
index de68cfd78..222be702b 100644
--- a/includes/common.php
+++ b/includes/common.php
@@ -611,25 +611,6 @@ function d_print_r($var, $no_debug_text = null) {
}
}
-/*
- * Shorten the name so it works as an RRD data source name (limited to 19 chars by default).
- * Substitute for $subst if necessary.
- * @return the shortened name
- */
-function name_shorten($name, $common = null, $subst = "mibval", $len = 19) {
- if ($common !== null) {
- // remove common from the beginning of the string, if present
- if (strlen($name) > $len && strpos($name, $common) >= 0) {
- $newname = str_replace($common, '', $name);
- $name = $newname;
- }
- }
- if (strlen($name) > $len) {
- $name = $subst;
- }
- return $name;
-}
-
/*
* @return the name of the rrd file for $host's $extra component
* @param host Host name
diff --git a/includes/snmp.inc.php b/includes/snmp.inc.php
index f4603e513..c0ee2e1dd 100644
--- a/includes/snmp.inc.php
+++ b/includes/snmp.inc.php
@@ -828,7 +828,6 @@ function snmp_mib_parse($oid, $mib, $module, $mibdir=null) {
if ($f[1] && $f[1] == 'OBJECT-TYPE') {
$result['object_type'] = $f[0];
$result['shortname'] = str_replace($mib, '', $f[0]);
- $result['dsname'] = name_shorten($f[0], $mib);
continue;
}
@@ -1081,8 +1080,8 @@ function save_mibs($device, $mibname, $oids, $mibdef, &$graphs) {
$mibdef[$oid]['shortname'],
$index,
),
- array('DS:'.$mibdef[$oid]['dsname'].":$type"),
- array($mibdef[$oid]['dsname'] => $val)
+ array("DS:mibval:$type"),
+ array("mibval" => $val)
);
}
}