设为首页 收藏本站
查看: 1176|回复: 0

[经验分享] cacti 简单配置安装

[复制链接]

尚未签到

发表于 2019-1-10 11:21:59 | 显示全部楼层 |阅读模式
Requirements
Cacti requires that the following software is installed on your system.

  •   RRDTool 1.0.49 or 1.2.x or greater
  •   MySQL 4.1.x or      5.x or greater
  •   PHP 4.3.6 or      greater, 5.x greater highly recommended for advanced features


  •   A Web Server      e.g. Apache or IIS




配置PHP


safe mode
cacti使用外部命令
; Safe Mode
; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode
safe_mode = Off


date and time
PHP 5.3开始,定义了一个date.timezone 设置,避免在时间/日期函数警告


; Defines the default timezone used by the date functions
; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone
date.timezone = "Europe/Berlin"中国还是用Asia/Shanghai


使用模板导入
如果你想允许导入模板,设置如下:
file_uploads = On


启用exec()的调用
safe_mode = Off


其他请看官方文档
http://docs.cacti.net/manual:087:1_installation.1_install_unix.1_configure_php




配置webserverapache
如果使用的是apache 1.3.x,不建议安装PHP 5


请找到文件“/etc/httpd/conf/httpd.conf”或者同等的确定该文件被include


# Load config files from the config directory "/etc/httpd/conf.d".
  Include conf.d/*.conf


现在请定位到PHP 的配置文件/etc/httpd/conf.d/php.conf
如果正在使用PHP 5,确保有以下几行:
# PHP is an HTML-embedded scripting language which attempts to make it
  # easy for developers to write dynamically generated webpages.
  LoadModule php5_module modules/libphp5.so
  #
  # Cause the PHP interpreter to handle files with a .php extension.
  AddHandler php5-script .php
  AddType text/html .php
  #
  # Add index.php to the list of files that will be served as directory
  # indexes.
  DirectoryIndex index.php


对于apache2.2
如果你没用安装 cacti到默认 web 目录,把cacti.conf 放到 /etc/httpd/conf.d改变
/your/cacti/dir到你的 cacti 目录名,改变允许从 127.0.0.1 指示到任何你所需要的(如公司的子网)。




# Cacti - the complete rrdtool-based graphing solution
#
# Allows only localhost by default
#
# Allowing cacti to anyone other than localhost should be considered
# dangerous unless properly secured by SSL


# Make sure, that httpd can read your cacti directories.
# At minimum, you need
#    chmod ugo+r -R /your/cacti/dir
# Make sure to replace with your directories


# When using SELinux, set the following:
#    chcon -R -h -t httpd_sys_content_t /your/cacti/dir
# when using SELinux and you private homedir, enable
#    setsebool -P httpd_enable_homedirs 1
#    setsebool -P httpd_read_user_content 1


Alias /cacti /your/cacti/dir

   AllowOverride None
   Order Deny,Allow
   Deny from all
   Allow from 127.0.0.1
   Allow from ::1
   Options Indexes Includes FollowSymLinks



# These directories do not require access over HTTP
#

    Order Deny,Allow
    Deny from All
    Allow from None



apache 2.4.x 拒绝和允许的规则要求略有不同


# Cacti - the complete rrdtool-based graphing solution
#
# Allows only localhost by default
#
# Allowing cacti to anyone other than localhost should be considered
# dangerous unless properly secured by SSL


# Make sure, that httpd can read your cacti directories.
# At minimum, you need
#    chmod ugo+r -R /home/reinhard/workspace
# Make sure to replace with your directories


# When using SELinux, set the following:
#    chcon -R -h -t httpd_sys_content_t /home/reinhard/workspace
# when using SELinux and you private homedir, enable
#    setsebool -P httpd_enable_homedirs 1
#    setsebool -P httpd_read_user_content 1


Alias /workspace /home/reinhard/workspace

#   AuthType Basic
#   AuthName "Cacti Pro's only"
#   AuthUserFile /var/www/passwd/passwords
#   Require valid-user
   AllowOverride None
# new stuff for apache 2.4
   Require ip 127.0.0.1
   Require host ::1
   Options Indexes Includes FollowSymLinks



# These directories do not require access over HTTP
#

    Require all denied





在启动 cacti 前,确认 httpd web服务已经启动




配置mysql
在启动 cacti 前,确认 mysql服务已经启动


默认地,mysql root 密码是没有设置的。鉴于安全原因,要求设置为 mysql root 用户设置密码


shell> mysqladmin --user=root password somepassword
   shell> mysqladmin --user=root --password reload





安装设置 SNMP
RedHat / Fedora : install the net-snmp, net-snmp-libs and net-snmp-utils packages


Building the Net-SNMP agent from source
可从sources.获得Net-SNMP agent


Here's how to get the configure options of an already running Net-SNMP agent:


$ snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.100.6.0
UCD-SNMP-MIB::versionConfigureOptions.0 = STRING: "'-disable-shared' '--with-mib-modules=host/hr_system'"




Configuring the Net-SNMP agent


Depending on how you've installed Net-SNMP, the main configuration file (snmpd.conf) is located in /etc/snmp (installation from package) or /usr/local/share/snmp (installation from tarball).
Please note that you need to restart (or send the HUP signal) the snmpd daemon whenever you modify snmpd.conf
The minimum configuration is this one:


rocommunity public


这将启用SNMP版本从任何主机1/2的只读请求,与团体名为public
有了这个最低配置,你就可以绘制CPU使用率,平均负载,网络接口,内存/交换区使用,登录的用户和进程数。




你可以限制哪些主机的SNMP查询是允许的:
rocommunity public 127.0.0.1
rocommunity test 87.65.43.21


默认情况下,Net-SNMP的监听UDP端口161上的所有IPv4接口上
用下面的例子中,Net-SNMP的将监听10.20.30.40 IP地址的UDP端口10000


agentaddress 10.20.30.40:10000


也可以使其监听与TCP端口,这也是在CACTI中被支持的。


agentaddress tcp:161


剩余的请看到官网。


本人这里是使用yum安装的方式
yum install net-snmp netsnmp-libs net-snmp-utils


安装rrdtool
yum install rrdtool




Install and Configure Cacti
http://docs.cacti.net/manual:087:1_installation.1_install_unix.5_install_and_configure_cacti






安装配置cacti


tar -xf cacti-0.8.8b.tar.gz -C /var/www/html/
mv /var/www/html/cacti-0.8.8b.tar.gz /var/www/html/cacti
cd /var/www/html/cacti
ln -s  /tmp/mysql.sock /var/lib/mysql/mysql.sock
mysqladmin --user=root -p123456 create cacti
mysql -uroot -p123456 cacti < cacti.sql


  

  

  

  




mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)


Edit “include/config.php” and specify the database type, name, host, user and password for your Cacti configuration.


http://blog.运维网.com/attachment/201312/195106440.png


http://blog.运维网.com/attachment/201312/195114189.png


http://blog.运维网.com/attachment/201312/195108887.png




yum install net-snmp netsnmp-libs net-snmp-utils


http://blog.运维网.com/attachment/201312/195111219.png




[root@localhost cacti]# useradd cactiuser
[root@localhost cacti]# passwd cactiuser
Changing password for user cactiuser.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.




http://SERVERIP/cacti/
账号密码:admin admin
然后会提示修改密码




PS:
源码安装rrdtool需要的依赖包有pkg-config、zlib、libpng、freetype、LibXML2、fontconfig、Pixman、Cairo、Glib、Pango。
自己试过以源码包的形式安装以上的依赖包,但是木有成功,提示某些库无法找到,应该是搜索路径的问题,应该要指定一下,若有大神弄好了可以交流一下!



  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-661593-1-1.html 上篇帖子: 完整的 cacti监控数据库占用空间的模板 下篇帖子: nagios和cacti 整体迁移
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表