xingyu655 发表于 2019-1-10 10:37:48

Gentoo 安装cacti 错误小结

1.cacti 安装时区出错
Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /var/www/localhost/htdocs/cacti/lib/functions.php on line 486
02/11/2014 06:25:10 AM - SYSTEM STATS: Time:0.1238 Method:cmd.php Processes:1 Threads:N/A Hosts:2 HostsPerProcess:2 DataSources:1 RRDsProcessed:1
OK u:0.00 s:0.00 r:0.02
解决如下

vim /etc/php/cli-php5.5/php.ini
date.timezone = Asia/Shanghai
vim /etc/php/apache2-php5.5/php.ini
date.timezone = Asia/Shanghai
  2.安装cacti-spine   emerge -avq cacti-spine
  登陆cacti后设置
Poller Type
The poller type to use. This setting will take effect at next polling interval.       spine (默认是cmd.php)

3.收集的时候出现
POLLER: Poller Maximum runtime of 300 seconds exceeded. Exiting
http://chinaapp.sinaapp.com/thread-tag/poller-poller0-maximum-runtime-of-298-seconds-exceeded-exiting
报错的原因是因为: cacti php
crontab里面默认执行时间超过了300秒,而cacti默认是5分钟就是300秒去获取一次数据,所以导致有些服务器的数据没有获取。
所以想到了增大spine的进程和线程数。 cacti->Console->setting->Poller->:
修改cacti setting的poller设置. settting–>poller: Maximum Concurrent Poller
Processes 把1改成4 Maximum Threads per Process 把1改成2 Number of PHP Script
Servers 把1改成6 即可
4.crontab -l
  */1 * * * * /usr/bin/php /var/www/localhost/htdocs/cacti/poller.php --force &>/dev/null
  5.Settings--poller
  Poller Interval
The polling interval in use. This setting will effect how often rrd's are checked and updated. NOTE: If you change this value, you must re-populate the poller cache. Failure to do so, may result in lost data. every minute
  Cron Interval
The cron interval in use. You need to set this setting to the interval that your cron or scheduled task is currently running.   every minute
  6.monitor 中文乱码
  你需要一个中文字体

  将它放进 /usr/share/fonts目录中

  # ls
  /usr/share/fonts # ls
  dejavuutil
  然后执行下面的命令刷新字体缓存
  # fc-cache -f -v
  然后再cacti 中设置 默认字体的路径为你使用的中文字体的路径
  测试发现, 字体只能放到系统字体路径当中, 并要刷新字体缓存
  
vim /var/www/localhost/htdocs/cacti/plugins/monitor/monitor.php

在monitor.php 文件中过滤 $name = $row['description'];这一行后边添加如下一行
  $name = iconv("UTF-8", "GB2312//IGNORE", $name);
  7.图形监控界面字符全部乱码,如下图
  http://s3.运维网.com/wyfs02/M02/24/43/wKioL1NOEPXyRAPVAAEUnBqt804929.jpg

  解决方法:从windows C:\Windows\Fonts,下面拷贝一个ttf(我拷贝的是simfang.ttf)文件到/usr/share/fonts下面,刷新页面,字符就正常显示了。
  8.只出现8小时的图   检测 Console -> Round Robin Archives   Data Sources   --- RRAs   
  Hourly(1 Minute average)    我在监控的时候没有用到,修改过后如果已经创建的还是没有生效,删除重建就行了
http://s3.运维网.com/wyfs02/M02/24/8B/wKiom1NR3G6Dk6n0AAE5K6wXOes760.jpg
  
  以下为转载;)
  一、修改监控查询区域的长度
1、中文版
配置 -> 设置 -> 外观 ->数据查询出将最大区域长度有15改为30即可。
2、英文版
Console -> Settings -> Visual -> Maximum Field Length: 默认15,修改为30。
二、修改流量监控的数据模板
我们打开流量监控使用的数据模板。发现流量的绘图引用的是Interface – Traffic (bits/sec)这个模板。修改过程如下:1、中文版
模板 -> 数据模板 ->Interface – Traffic ->数据源-> 名字,将

[*]  |host_description| - Traffic
修改为

[*]  |host_description| - Traffic– |query_ifName|。
2、英文版

[*]  console–Graph Templates–Interface – Traffic Graph Template -> Title (--title) 将|host_description| - Traffic
修改为

[*]  |host_description| - Traffic– |query_ifName|
在后面的框框里面加上了 – |query_ifName| 这部分内容,以前这里是没有的!
三、设置成功
重新添加图形,我们发现端口已经出来了!
  不能正常出图,注意查看日志 Console -> Utilities -> View Cacti Log File




页: [1]
查看完整版本: Gentoo 安装cacti 错误小结