chenjiali 发表于 2019-1-11 09:07:39

[Linux] Cacti_0.8.7g上安装插件模块

  http://www.mcncc.com/thread-60811-1-1.html
  1、增加cacti插件的方法:为cacti系统安装Thold、Monitor等插件
  插件下载地址:http://cactiusers.org/downloads/
  注意下载时注意相应版本,版本不会产生问题。monitor插件,提供更简略、直观的设备状态图示;thold插件
  提供设备异常预警。
  安装thold、monitor插件:注意先备份一下
  (1)、安装Plugin Architocture补丁,安装后,才能启用thold、monitor插件
  #wge thttp://mirror.cactiusers.org/downloads/plugins/cacti-plugin-0.8.7g-PA-v2.8.tar.gz
  #tar -xzfcacti-plugin-0.8.7g-PA-v2.8.tar.gz
  复制解压后cacti-plugin-0.8.7e-PA-v2.6下的所有文件到/var/www/cacti/下然后然后在cacti目录下执行如下命令
  #patch -p1 -N < cacti-plugin-0.8.7e-PA-v2.6.diff
  #mysql cacti < pa.sql
  (2)、安装thold、monitor插件
  #wget http://cactiusers.org/downloads/settings.tar.gz
  #wget http://cactiusers.org/downloads/thold.tar.gz
  #wget http://cactiusers.org/downloads/monitor.tar.gz
  #tar -zxvf settings.tar.gz
  #tar -zxvf thold.tar.gz
  #tar -zxvf monitor.tar.gz
  # cp –r settings thold monitor /var/www/cacti/plugins/
  # mysql cacti < thold.sql
  # mysql cacti < monitor.sql
  (3)、修改config.php配置文件
  此时要注意了我是在vmware上的RedHat5.0上安装cacti的,不知道是什么原因,可能是Cacti 0.8.7g的版本和Redhat有冲突,在这里不能config.php,如果你是在Centos上安装cacti就没有这样的问题,如果你要是在Redhat上安装Thlod的话可以忽略修改config.php的步骤!!
  Redhat中的global.php种没有$plugins这些选项(这是Centos下的),在Redhat下要修改config.php文件。
  # vi /var/www/html/cacti/include/config.php
  修改为
  --------------------------------------------------------
  $plugins = array();
  $plugins[] = &quot;thold&quot;;
  $plugins[] = &quot;monitor&quot;;
  $plugins[] = &quot;settings&quot;;
  $url_path = &quot;/cacti/&quot;;
  (4)、此时刷新cacti的web管理界面,可以看到多出两个标签页(thold,monitor)。
  (5)、使用monitor插件
  1>打开“Console->Settings->Misc”,可以调整Monitor的各项配置。例如:勾选“Show Icon Legend”可以在监控页面显示图例;
  &quot;View“可以选用Titles类型,以显示设备状态表格。
  2>为cacti添加新设备时,勾选上“Monitor Host”项。对已添加的设备/主机的状态图示。
  (6)、使用thold插件
  1>打开“Console->Settings->Mail/DNS”,可以调整“SMTP Options”和“DNS Options”等配置,用于确保预警邮件能够发出。
  2>打开“Console->Settings->Alerting/Thold”,可以调整Thold的各项配置。例如:“Dead Host Notifications Email”处可填写设备当机时发送警告信息到哪个邮箱;勾选 “Send alerts as text”项,可以设置只发送文本格式的邮件。
  3>打开“Templates->Threshold Templates”,可以添加、取出需要关联到预警系统的模板,例如:可以添加和“Interface-Traffic”模板的关联,选择“traffic_in”、“traffic_out”数据项,分别设置警告阈值“High Threshold”(如200000000比特/秒);可以添加和“Unix-Disk Space”模版的关联......。
  4>打开“Create->New Graphs”,选择需要提供预警的设备,单击右侧上方的“Auto-create thresholds”创建预警项目。
  5>打开“Management->Thresholds”,可以管理已经创建的预警项目。
  2、cacti监控键盘I/O的方法;
  cacti本身的模板只可以监控硬盘的使用大小,而不能监控使用百分率,所以我们可以自定义cdef来监控磁盘使用率,并借助thold插件实现报警功能。网上找的资料都是在cacti.0.8.6版上实现的,而我们用的是cacti.0.8.7版,因此,根据实际情况作如下改动;
  在cacti目录下:
  # vi global_arrays.php
  搜索custom_data_source_types = array(
  &quot;CURRENT_DATA_SOURCE&quot; => &quot;Current Graph Item Data Source&quot;,
  &quot;ALL_DATA_SOURCES_NODUPS&quot; => &quot;ALL Data Sources (Don't Include Duplicates)&quot;,
  &quot;ALL_DATA_SOURCES_DUPS&quot; => &quot;All Data Sources (Include Duplicates)&quot;,
  &quot;SIMILAR_DATA_SOURCES_NODUPS&quot; => &quot;All Similar Data Sources(Don't Include Duplicates)&quot;,
  &quot;SIMILAR_DATA_SOURCES_DUPS&quot; => &quot;All Similar Data Sources(Include Duplicates)&quot;,
  &quot;CURRENT_DS_MINIMUM_VALUE&quot; => &quot;Current Data Source Item; Minimum Value&quot;,
  &quot;CURRENT_DS_MINIMUM_VALUE&quot; => &quot;Current Data Source Item; Minimum Value&quot;,
  &quot;CURRENT_GRAPH_MINIMUM_VALUE&quot; => &quot;Graphower Limit&quot;,
  //添加以下两行
  &quot;CURRENT_GRAPH_MAXIMUM_VALUE&quot; => &quot;Graph:Upper Limit&quot;,
  &quot;VALUE_OF_HDD_TOTAL&quot; => &quot;Value of hdd_total data source&quot;);
  //中文版汉化为:
  &quot;VALUE_OF_HDD_TOTAL&quot; => &quot;所有硬盘数据的值&quot;);
  在cacti界面的Graph Management-cdefs新建cdef模块,名字自己起,添加字段如下:
  Item #1 Special Data Source:CURRENT_DATA_SOURCE
  Item #2 Custom String:100
  Item #3 Operator:*
  Item #4 Special Data Source:VALUE_OF_HDD_TOTAL
  Item #5 Operator:/
  也就是说
  cdef=CURRENT_DATA_SOURCE00,*,VALUE_OF_HDD_TOTAL,/
  这样就可以在Threshold Templates里面添加监控硬盘的模块了,我添加的是Host MIB — Hard Drive Space,最后在Threshold CDEF里面选择刚自定义的cdef,这样就可以正常监控硬盘使用率了。
  下面把使用方法摘录如下:
  1.Copy net-snmp_devio.xml to /resource/snmp_queries/net-snmp_devio.xml
  2.Import all *_templ.xml via Cacti &quot;Import Templates&quot; interface - These templates should include all their dependancies
  3. Add &quot;ucd/net - Get Device I/O&quot; Data Query to your SNMP Enabled host using the &quot;Index Count Changed&quot; Re-index Method.
  4.Create Graphs for your desired Disk and/or Memory devices.
  总体注意事项:
  1)、很重要的一点:在cacti的设备中一定要选择snmp的版本为>=2,否则会获取不到cpu和网卡等相关信息。
  2)、cacti自带的local视图内存监控单位是错误的,可以删掉重新创建,就会改正。
  3)、系统监控中,cpu图标的200m这类数字,标示的是万分之多少,我的理解cacti是为了方便显示画图。
  4)、权限的问题:rra log目录的权限问题 要给crontab的执行者完全控制权限。

页: [1]
查看完整版本: [Linux] Cacti_0.8.7g上安装插件模块