`
javasogo
  • 浏览: 1770769 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Cacti在Solaris10下的安装

阅读更多
=====================================================================================================================
Solaris下MySQL的安装:
1.Solaris下的MySQL目录:
/usr/sfw/sbin:守护进程mysqld,mysqld_safe
/usr/sfw/bin:管理工具mysqladmin,mysqlcheck等
/usr/sfw/share/mysql/:配置文件 my-medium.cnf等
/var/mysql:MySQL数据目录
/usr/sfw/include/mysql:MySql的头文件
2.配置MySQL配置文件
-bash-3.00#cp /usr/sfw/share/mysql/my-medium.cnf /etc/my.cnf
-bash-3.00#vi /etc/my.cnf
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
##Modified content MartriWang@gmail.com
#socket = /var/lib/mysql/mysql.sock
socket = /home/mysql/5.0/mysql/mysql.sock

# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
#socket = /var/lib/mysql/mysql.sock
##Modified content MartriWang@gmail.com
socket = /home/mysql/5.0/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
3.创建mysql用户
-bash-3.00#useradd -u 1002 mysql
-bash-3.00#groupadd -g 1002 mysql mysql
-bash-3.00#mkdir /export/home/mysql
4.启动mysql
-bash-3.00#./mysqld &
发生如下错误:
080424 15:45:53 InnoDB: Started
080424 15:45:53 Fatal error: Can't open privilege tables: Table 'mysql.host' doesn't exist
080424 15:45:53 Aborting
解决方法:
rm -rf /pathtodatadir
then
cd /usr/local/mysql1/bin
./mysql_install_db --user=mysql --ldata=/var/mysql
./mysqld_safe --datadir=/var/mysql --user=mysql &
5.安装成功
备份:[root@MT src]#mysqldump -u root -p --opt mysql > mysql_back
恢复:[root@MT src]#mysql -u root -p mysql < mysql_back
=====================================================================================================================
Solaris下apache的安装
1.Solaris下的Apache目录:
/usr/apache2:主目录,如/usr/apache2/bin下有apachectl,httpd
/etc/apache2/:配置文件,如httpd.conf-example
/var/apache2/logs:日志文件
/var/run/apache2/httpd.pid:运行目录
2.配置文件
-bash-3.00#cp /etc/apache2/httpd.conf-example /etc/apache2/httpd.conf
-bash-3.00#vi /etc/apache2/httpd.conf
Set ServerName if necessary (default is 127.0.0.1)
Set ServerAdmin to a valid email address
如没有目录/var/run/apache2/则需要创建此目录
3.运行./usr/apache2/bin/apachectl start &
或者,启用apache服务:
-bash-3.00# svcadm enable apache2
=====================================================================================================================
Solaris下PHP的安装
1.编译安装
./configure --prefix=/usr/local/php --with-apxs2=/usr/apache2/bin/apxs --with-mysql=/usr/sfw/include/mysql
--with-config-file-path=/usr/local/php/etc
错误一:
checking for int8... (cached) no
checking base type of last arg to accept... (cached) socklen_t
checking return type of qsort... (cached) void
configure: error: Cannot find MySQL header files under /usr/
将--with-mysql=/usr/sfw/include/mysql改为--with-mysql=/usr/sfw/便可解决
错误二:
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path... /usr/bin/xml2-config
configure: error: libxml2 version 2.6.11 or greater required.
解决方法有二:
一是采用低版本的php-4.4.8.tar.gz
二是升级libxml2和重新安装一个libxml2(不推荐,容导致系统版本不一直而崩溃)或重新安装一个新的libxml2(推荐)
tar zxvf libxml2-2.6.26.tar.gz
./configure –prefix=/usr/local/libxml
make;make install
重启机子,更新模块
2.配置PHP
检查htppd.conf文件中是否插入“LoadModule php5_module modules/libphp5.so“
手动插入行“AddType application/x-httpd-php .php .phtml”
注意不要象一些文档说的加入两句:
#AddHandler php4-script .php
AddType application/x-httpd-php .php
这是错误
测试页面:<?phpinfo()?>
=====================================================================================================================
Solaris下net-snmp和rrdtool的安装
1.net-snmp的安装
./configure
make;make install
如CACTI出现如下错误:
.Encryption support not enabled.
snmpbulkwalk: USM encryption error
Encryption support not enabled.
解决方法:
You probably need to install the openssl-dev package and rebuild net-snmp.
2.修改snmp的配置文件:
#vi /usr/local/share/snmp/snmpd.conf
修改下面几部分内容:
1)com2sec notConfigUser default public
改为:com2sec notConfigUser localhost public
2)access notConfigGroup "" any noauth exact systemview none none
改为:access notConfigGroup "" any noauth exact all none none
3)#view all included .1 80
4)createUser frederic MD5 mypassphrase DES
group groupv3 usm frederic
access groupv3 "" any auth exact all all all

修改计划任务,使CACTI每5分钟获得一次数据:
#crontab -e 用户名
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/php/bin/php /var/apache2/htdocs/cacti/poller.php > /dev/null 2>&1

3.测试SNMP
snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.100.6.0
snmpget -v 3 -l AuthNoPriv -u frederic -A mypassphrase 192.168.0.6 sysName.0

2)Test configuration
snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0
--query which Net-SNMP version is running on a host
snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.100.2.0
snmpwalk -v 1 -c foo localhost .1.3.6.1.2.1.1.1.0
--An incorrect passphrase will result in this error message
snmpget -v 3 -l AuthNoPriv -u frederic -A badpassphrase 192.168.0.6 sysName.0
--This query will show you what filesystems are mounted
snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9.1.2
--display your network interfaces
snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.2.2.1.2


snmpwalk -v 2c -c public 192.168.0.6 if
/usr/local/php/bin/php /var/apache2/htdocs/cacti/cli/poller_reindex_hosts.php -id=All


Timeout: No Response from 192.168.0.6:161.
04/28/2008 12:14:55 PM - SYSTEM STATS: Time:4.4020 Method:cmd.php Processes:1 Threads:N/A Hosts:2
HostsPerProcess:2 DataSources:14 RRDsProcessed:0
=====================================================================================================================
1.rrdtool的安装

perl /scripts/unix_users.pl cacti

/usr/local/cactid/bin/cactid --conf=/usr/local/cactid/etc/cactid.conf

1)rrdtool dump two_gw_call_monitor_connectednew_2954.rrd > /tmp/2954.xml

2)sed -i -e 's/NaN/2.4300000000e+02/' 2954.xml

3)rrdtool restore -f 2954.xml two_gw_call_monitor_connectednew_2954.rrd

/usr/local/php/bin/php /var/apache2/htdocs/cacti/poller.php
/var/spool/cron/crontabs/cacti

/usr/local/rrdtool-1.2.19/bin/rrdtool fetch localhost_mem_buffers_14.rrd AVERAGE
/usr/local/rrdtool-1.2.19/bin/rrdtool info localhost_mem_buffers_14.rrd

php rebuild_poller_cache.php -d
=====================================================================================================================
Solaris下CACTI的安装
1.修改配置
grant all privileges on *.* to 'cacti'@'localhost' identified by 'cacti'
/usr/sfw/bin/mysql -ucacti -pcacti cacti < cacti.sql

#vi include/config.php
修改如下段落:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
改为:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "用户名";
$database_password = "你的密码";
$database_port = "3306";

2.修改CACTI的配置文件
#chown -R rra/ log/
这样cacti就基本配置完成了
在浏览器里输入IP/cacti,错误提示:
Please make sure you have specified a valid MySQL database name in 'include/config.php'
解决方法为修改/etc/my.cnf文件:
socket = /tmp/mysql.sock
##MartriWang@gmail.com 20080425
#socket = /var/lib/mysql/mysql.sock
##http://192.168.0.6/cacti
用户名和密码是admin和admin
3.crontab自启动
注意Solaris下,命令行可以有结果,而crontab没有,则是因为使用的环境变量不同所致,
应该加上/export/home/cacti/.bash_profile,如下:
0,5,10,15,20,25,30,35,40,45,50,55 * * * *
. /export/home/cacti/.bash_profile; /opt/php/bin/php /opt/cacti/cacti-0.8.6b/poller.php

=====================================================================================================================
CACTI使用技巧:
1、cacti的流程是从Data Input Methods开始,创建一个信息采集的方法先,里面定义了采集的方法和采集需要的脚本(注意:
如果使用CACTID最好使用可执行文件的全路径),可以定义一个输入和输出。输入可以为你执行这个脚本带入参数,比如连接
数据库的参数,这样只要设置这个参数就可以连上不同的数据库了。输出是信息采集的输入结果,以列名+冒号+采集结果的
形式返回。
2、然后是数据模版,里面需要选择Data Input Methods,如果数据输入方法中有参数的,这里可以设置参数,也可以选择忽略
这个设置,然后到最后配置图形的时候再输入特定的参数。
3、创建图形模版,里面需要定义图形的ITEM,可以使用AREA方式先画一个框,然后把其他值以STACK的方式往前面的AREA上面
累加。也可以使用GPRINT方式在最下面的备注那里输出些信息(一般是输入最后采集时候的值)。这里可以定义CDEF function,
这个函数可以把你显示的ITEM进行转换,比如把8k转换成8192字节等,这个函数可以自定义的(可以参考Graph Management中的
CDEFs中的定义来进行自定义)。
4、创建DATASOURCE,然后创建GRAPH。
最后可以把他们放到一个TREE上
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics