yl197837 发表于 2019-1-10 09:24:16

cacti 安装插件

  cacti 下载支持url地址:http://docs.cacti.net/
  monitor插件,提供更简略、直观的设备状态图示;监视器
  thold插件,提供设备异常预警。阈值
  syslog插件,提供cacti日志监控服务
  settings:给不同的插件提供一些共用的信息,如邮件信息,dns信息
  weathermap:绘制网络拓扑的插件,气象图
  discover:的功能就是让cacit自动发现主机,自动加入主机,自动画图
  monitor插件的安装
  #tar zxvfmonitor-0.8.2.tar.gz
  #mv monitor /usr/local/wwwroot/cacti/plugins/
  点击console ->Plugin Management->在Actions处启用Monitor
  进入"User Management"->点admin->Realm Permissions->勾选View Monitoring ,至此Monitor插件安装完成。
  thold插件的安装
  #tar zxvfthold-0.4.3.tar.gz
  #mv thold /usr/local/wwwroot/cacti/plugins/
  点击console ->Plugin Management->在Actions处启用thold
  点击console ->Settings->Misc->Monitor->Grouping设置tree->View设置list,这时点击thold选项点击设备可以看到流量图
  settings插件的安装
  #tar zxvfdiscovery-0.8.5.tar.gz
  #mv settings /usr/local/wwwroot/cacti/plugins/
  点击console ->Plugin Management->在Actions处启用settings
  discovery插件的安装
  #tar zxvfdiscovery-0.8.5.tar.gz
  #mv discovery /usr/local/wwwroot/cacti/plugins/
  点击console ->Plugin Management->在Actions处启用discovery
  进入"User Management"->点admin->Realm Permissions->勾选View Host Auto-Discovery ,至此discovery插件安装完成
  weathermap插件的安装
  #uzip php-weathermap-0.97a.zip
  #mv weathermap /usr/local/wwwroot/cacti/plugins/
  #chown -R apache.apache /usr/local/wwwroot/cacti/plugins/weathermap
  对weathermap的配置文件进行修改
  #cd /usr/local/wwwroot/cacti/plugins/weathermap
  #chmod u+w config/
  #cp editor-conifg.php-dist editor-config.php#vieditor-config.php
  $cacti_base = "/usr/local/wwwroot/cacti";
  $cacti_url = "http://222.186.43.15/cacti";
  $mapdir= $cacti_base .' /plugins/weathermap/configs';
  $ignore_cacti = FALSE;
  将editor.php中的ENABLED=false修改为true,否则weathermap点击Editor时会报错
  #cd /usr/local/wwwroot/cacti/plugins/weathermap
  #vi editor.php
  //$ENABLED=false;将false修改为true
  $ENABLED=true;
  点击console ->Plugin Management->在Actions处启用weathermap,至此weathermap插件安装完成。
  syslog插件的安装
  1.安装syslog-ng服务
  #rpm -ivh syslog-ng-2.1.4-1.el5.i386.rpm
  2.安装syslog插件
  #tar zxvfsyslog-0.5.2.tar.gz
  #mv syslog /usr/local/wwwroot/cacti/plugins/
  点击console ->Plugin Management->在Actions处启用syslog
  进入"User Management"->点admin->Realm Permissions->勾选View Syslog和
  Configure Syslog Alerts / Reports
  #mysql -uroot -p
  mysql>create databasesyslog;      创建一个数据库供syslog使用mysql>usesyslog;

  mysql>source /usr/local/wwwroot/cacti/plugins/syslog/syslog.sql   导入mysql数据库mysql>grant all on syslog.* to cacti@localhost>  #cd /usr/local/wwwroot/cacti/plugins/syslog
  #vi config.php
  $syslogdb_type   = 'mysql';
  $syslogdb_default= 'syslog';
  $syslogdb_hostname = 'localhost';
  $syslogdb_username = 'cacti';
  $syslogdb_password = 'cacti';
  #vi /etc/syslog-ng/syslog-ng.conf 在最后末尾添加如下:
  source net {
  udp();
  };
  destination d_mysql {
  pipe("/tmp/mysql.pipe"
  template("INSERT INTO syslog_incoming (host, facility, priority, date, time, message) VALUES ( '$HOST', '$FACILITY', '$PRIORITY', '$YEAR-$MONTH-$DAY', '$HOUR:$MIN:$SEC', '$MSG' );\n")
  template-escape(yes)
  );
  };
  log { source(net); destination(d_mysql); };
  log { source(s_sys); destination(d_mysql); };
  完成之后,执行
  #service syslog restart
  #service syslog-ng restart
  在syslog插件目录下,编辑一个新的sh文件/plugins/syslog/syslog2mysql.sh,并且赋予可执行权限(同时该目录下
  syslog_process.php也必须有可执行权限):
  #vi /usr/local/wwwroot/cacti/plugins/syslog/syslog2mysql.sh输入
  #!/bin/bash
  if [ ! -e /tmp/mysql.pipe ]
  then
  mkfifo /tmp/mysql.pipe
  fi
  while [ -e /tmp/mysql.pipe ]
  do mysql -u root syslog < /tmp/mysql.pipe >/dev/null
  done
  运行syslog2mysql.sh,如果没有任何显示,后台有该进程,则基本上成功了。在/etc/crontab中添加:
  @reboot /usr/local/wwwroot/cacti/plugins/syslog2mysql.sh
  */1 * * * * php /usr/local/wwwroot/cacti/plugins/syslog_process.php
  使开机执行syslog2mysql.sh,每分钟执行一次syslog_process.php

页: [1]
查看完整版本: cacti 安装插件