Linux 判断Cacti模板的版本


经常有人在 import从网上download的cacti template时发生”Error: XML: Hashversion does not exist” 错误。

这是因为 export template的cacti和import template的cacti的版本不同引起的。为了保证兼容性,cacti有一个机制会阻止从新版本cacti导出的模板被导回到旧版本的cacti 中。

那么如何判断一个模板所使用的cacti版本呢?方法是查看template中的hash后边的字符串的值。举例如下:

这 是一个template中的一段 <hash_040018258d1c9487a6c58dd804f4a012007664>
头 两位蓝色的数字是template的类型.
接下来的4位红色数字Cactiversion ,这就是我们要找的东西!!!
接下来的32位数字是系统随机生成.

每个cacti版本对应的数 字记录在/var/www/html/cactig/include/global_arrays.php文件中,具体参考下边我摘录的部分:

$hash_version_codes = array(
"0.8.4"  => "0000",
"0.8.5"  => "0001",
"0.8.5a" => "0002",
"0.8.6"  => "0003",
"0.8.6a" => "0004",
"0.8.6b" => "0005",
"0.8.6c" => "0006",
"0.8.6d" => "0007",
"0.8.6e" => "0008",
"0.8.6f" => "0009",
"0.8.6g" => "0010",
"0.8.6h" => "0011",
"0.8.6i" => "0012",
"0.8.6j" => "0013",
"0.8.7"  => "0014",
"0.8.7a" => "0015",
"0.8.7b" => "0016",
"0.8.7c" => "0017",
"0.8.7d" => "0018"
);

相关内容