这个是Nagios和Cacti安装与配置的第三个步骤,就是给cacti打补丁和安装weathermap插件,建立在之前的实验平台上,此文章主要介绍安装。
第一部分:
装cati-plugin的解决方案
需要的套件 cacti-plugin-0.8.7h-PA-v3.0.tar.gz
[root@localhost ~]# tar zxvf cacti-plugin-0.8.7h-PA-v3.0.tar.gz
[root@localhost ~]# cd cacti-plugin-arch/
[root@localhost cacti-plugin-arch]# cp -rf files/* /var/www/cacti/
[root@localhost cacti-plugin-arch]# cd /var/www/cacti/
[root@localhost cacti]# mysql -u root cacti < ~/cacti-plugin-arch/pa.sql
[root@localhost cacti]# cd include/
[root@localhost include]# vi global.php //修改以下的字段即可
$database_username = "cactiuser";
$database_password = "721wyzj";
if (! isset($url_path)) {
$url_path = "/cacti/";
}
之后登陆http://192.168.1.192/cacti/index.php User Management-->admin-->Plugin Management (添加上这个即可)
实验总结
之前一直采用类似以下的方式补丁步骤
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.8.diff
之后再修改vi /var/www/cacti/include/global.php
$database_username = "cactiuser";
$database_password = "721wyzj";
$config['url_path'] = '/cacti/';
但是很无奈登陆时一直出现Call to undefined function api_plugin_hook() 的错误提示,谷歌了好多解决方案,都不奏效,后来发现解开压缩包所在的目录下有files的目录,再结合网络的搜索得知,还有另外一种方案--覆盖,于是就尝试的去做也就是以上成功的案例,终于问题解决,深吸一口气啊!
第二部分:weathermap插件的安装
[root@localhost ~]# ll php-weathermap-0.97a.zip
-rw-r--r-- 1 root root 2927302 Oct 16 2011 php-weathermap-0.97a.zip
[root@localhost ~]# unzip php-weathermap-0.97a.zip
[root@localhost ~]# mv weathermap/ /var/www/cacti/plugins
[root@localhost ~]# cd /var/www/cacti/plugins/weathermap/
[root@localhost weathermap]# chown -R cactiuser output/
[root@localhost weathermap]# chown -R apache configs/
[root@localhost weathermap]# chmod -R u+w configs/
[root@localhost weathermap]# cp editor-config.php-dist editor-config.php
[root@localhost weathermap]# vi editor-config.php
$cacti_base = "/var/www/cacti";
$cacti_url = "http://192.168.1.192/cacti/";
$mapdir= $cacti_base.'/plugins/weathermap/configs';
[root@localhost weathermap]# vi editor.php //从false修改成ture
$ENABLED=ture;
这样就设置成功了,接着就是web的操作,为了安装这个软件耗费很久的时间,最后解决的办法是修改global.php里的url_path为/cacti/,之前不需要修改的这个,没想到在插件里用到了,这是出其不意啊!