cacti 简单配置安装

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

<Directory /your/cacti/dir>

  AllowOverride None

  Order Deny,Allow

  Deny from all

  Allow from 127.0.0.1

  Allow from ::1

  Options Indexes Includes FollowSymLinks

</Directory>


# These directories do not require access over HTTP

#

<Directory /your/cacti/dir/cli>

   Order Deny,Allow

   Deny from All

   Allow from None

</Directory>


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

<Directory /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

</Directory>


# These directories do not require access over HTTP

#

<Directory /home/reinhard/workspace/cacti087/cli>

   Require all denied

</Directory>



在启动 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






195116758.png


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.


195106440.png


195114189.png


195108887.png



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


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。

自己试过以源码包的形式安装以上的依赖包,但是木有成功,提示某些库无法找到,应该是搜索路径的问题,应该要指定一下,若有大神弄好了可以交流一下!


你可能感兴趣的:(安装,配置,编译,cacti)