免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3081 | 回复: 0
打印 上一主题 下一主题

在Solaris上安装CACTI [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-05-09 10:01 |只看该作者 |倒序浏览

完整安装solaris10
# uname –a(查看操作系统版本)
SunOS CACTIWEB 5.10 Generic_120011-14 sun4u sparc SUNW,Sun-Blade-1000
# isainfo -b (查看操作系统版本是32bit还是64bit)   
64
配置ssh和ftp的root权限(安装完毕后需还原原始配置,保证服务器安全性)
修改ssh配置文件,允许以root身份ssh登陆
#vi /etc/ssh/sshd_config
查找
# Are root logins permitted using sshd.
# Note that sshd uses pam_authenticate(3PAM) so the root (or any other) user
# maybe denied access by a PAM module regardless of this setting.
# Valid options are yes, without-password, no.
PermitRootLogin no 将no改为yes
保存退出后输入:svcadm restart ssh(重启ssh服务)
修改ftp配置,允许以root身份进行上传
# vi /etc/ftpd/ftpusers

# ident "@(#)ftpusers   1.5     04/02/20 SMI"
#
# List of users denied access to the FTP server, see ftpusers(4).
#
root 在root前加上#号注释掉即可
daemon
bin
sys
adm
lp
uucp
nuucp
smmsp
listen
gdm
webservd
nobody
noaccess
nobody4)
保存退出以后输入:# svcadm restart ftp(重启ftp服务)
修改配置将root用户的默认目录设置成/root
#mkdir /root
# vi /etc/passwd
将root:x:0:0:Super-User:/:/sbin/sh 修改成 root:x:0:0:Super-User:/root:/sbin/sh
保存退出
个性化设置,将root用户默认shell设置成bash,默认编辑器设置vi,美化登陆提示设置环境变量
usermod -s /bin/bash root(修改默认shell为bash,因为修改的是自己,所以下次登陆才生效)
# cd /root(进入root用户的默认目录)
# vi .bash_profile(这里需要bash的默认配置文件是.bash_profile,其它shell请参照文档)

export PATH=$PATH:/usr/ccs/bin:/usr/ucb:/usr/bin:/usr/openwin/bin:
export PATH=$PATH:/usr/dt/bin:/opt/csw/bin:/usr/sbin:/opt/csw/sbin:
export PATH=$PATH:/opt/csw/mysql5/bin:/opt/csw/apache2/bin:
export PATH=$PATH:/opt/csw/gcc3/bin:/opt/csw/php5/bin:/opt/csw/netsnmp/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/opt/csw/lib/sparcv9:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/csw/lib:/opt/csw/gcc3/lib:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/csw/php/lib:/opt/csw/netsnmp/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/csw/mysql5/lib/mysql
EDITOR=vi
export EDITOR
PS1='[\u@\h:$PWD]#'
export PS1
保存退出

关闭不需要的系统服务
# mv /etc/rc3.d/S50apache  /etc/rc3.d/OFFS50apache(修改文件名称启动时不能找到便不能启动
# svcadm disable telnet
# svcadm disable snmpdx
#svcadm disable sma(自带的netsnmp一定要关闭)
#svcadm disable dmi(snmp的子进程)
[root@CACTIWEB:/etc/rc3.d]#svcadm disable svc:/application/management/seaport(snmp相关进程)
卸载多余软件(可选)
# pkgrm SUNWaclg SUNWapch2d SUNWapch2r SUNWapch2u SUNWapchd SUNWapchr SUNWapchu SUNWmysqlr SUNWmysqlt   SUNWmysqlu SUNWmibii SUNWjsnmp

# reboot(重新启动)

安装软件:(使用pkgget工具进行安装)
#pkgadd -d
http://www.blastwave.org/pkg_get.pkg
使软件下载以后自动安装
cp /var/pkg-get/admin-fullauto /var/pkg-get/admin
搭建amp平台
安装mysql
#/opt/csw/bin/pkg-get –i wget mysql5 mysql5devel mysql5test(安装mysql)
创建mysql5的配置文件:
cp /opt/csw/mysql5/share/mysql/my-medium.cnf /opt/csw/mysql5/my.cnf(服务器较差可以选择my-small.cnf)
初始化数据库并给予mysql用户权限
#/opt/csw/mysql5/bin/mysql_install_db
#chown -R mysql:mysql /opt/csw/mysql5/var/
启动mysql服务
#svcadm enable cswmysql5
设置mysql口令
/opt/csw/mysql5/bin/mysqladmin -uroot password '你的密码'
安装apache2
/opt/csw/bin/pkg-get -i apache2 apache2c  apache2rt  apache2_devel
安装完apache2后的软件包信息
安装编译环境和编译php所需要的库
pkg-get -i autoconf automake gcc3 gmake flex gm4 gtar libxml2 gd libtool
编译安装netsnmp
下载最新netsnmp源代码包www.net-snmp.org上传到服务器解压缩
gunzip -cd net-snmp-5.4.1.tar.gz | gtar xvpf –
cd net-snmp-5.4.1
如果你是sun4u的系统(可以用uname –a查看,需要编辑./include/netsnmp/system/solaris.h在文件底部加入#define NEW_MIB_COMPLIANT)
./configure --prefix=/opt/csw/netsnmp \
--enable-shared \
--with-default-snmp-version=2 \
--enable-mfd-rewrites \
--with-mib-modules=" \
mibII \
host \
disman/event-mib \
if-mib \
tcp-mib \
udp-mib \
ucd-snmp/lmSensors \
ucd_snmp agent_mibs \
agentx notification \
target utilities \
ucd-snmp/diskio \
mibII/mta_sendmail "

gmake

gmake install

进行snmpd的配置
/opt/csw/netsnmp/bin/snmpconf –g basic_setup
运行后会出现一个询问菜单,按如下步骤进行回答:CODE:[Copy to clipboard]Do you want to configure the information returned in
the system MIB group (contact info, etc)? (default = y): y
The location of the system: Shenzhen, China
The contact information:
master@emerson.com
Do you want to properly set the value of the sysServices.0 OID (if you don't know, just say no)? (default = y): y
does this host offer physical services (eg, like a repeater) [answer 0 or 1]: 1
does this host offer datalink/subnetwork services (eg, like a bridge): 0
does this host offer internet services (eg, supports IP): 1
does this host offer end-to-end services (eg, supports TCP): 1
does this host offer application services (eg, supports SMTP): 1
Do you want to configure the agent's access control? (default = y): y
Do you want to allow SNMPv3 read-write user based access (default = y): n
Do you want to allow SNMPv3 read-only user based access (default = y): n
Do you want to allow SNMPv1/v2c read-write community access (default = y): n
Do you want to allow SNMPv1/v2c read-only community access (default = y): y
The community name to add read-only access for: public
The hostname or network address to accept this community name from [RETURN for all]: (RETURN)
The OID that this community should be restricted to [RETURN for no-restriction]: (RETURN)
Do you want to configure where and if the agent will send traps? (default = y): n
Do you want to configure the agent's ability to monitor various aspects of your system? (default = y): y
Do you want to configure the agents ability to monitor processes? (default = y): y
Name of the process you want to check on: sshd(需要监控的进程)
Maximum number of processes named ' sshd' that should be running [default = 0]: 1
Minimum number of processes named ' sshd' that should be running [default = 0]: 0
Do another proc line? (default = y): n
Do you want to configure the agents ability to monitor disk space? (default = y): y
Enter the mount point for the disk partion to be checked on: /
Enter the minimum amount of space that should be available on /var: %100
Do another disk line? (default = y): y
Enter the mount point for the disk partion to be checked on: /var
Enter the minimum amount of space that should be available on /var: %100
Do another disk line? (default = y): y
Enter the mount point for the disk partion to be checked on: /usr
Enter the minimum amount of space that should be available on /usr: %100
Do another disk line? (default = y): y
Enter the mount point for the disk partion to be checked on: /home
Enter the minimum amount of space that should be available on /home: %100
Do another disk line? (default = y): n
Do you want to configure the agents ability to monitor load average? (default = y): y
Enter the maximum allowable value for the 1 minute load average: 12
Enter the maximum allowable value for the 5 minute load average: 12
Enter the maximum allowable value for the 15 minute load average: 12
Do another load line? (default = y): n
Do you want to configure the agents ability to monitor file sizes? (default = y): n(如果想监控文件的大小,可以选y)
完成后将conf文件复制到/opt/csw/netsnmp/share/snmp
cp snmpd.conf /opt/csw/netsnmp/share/snmp/
运行snmpd
/opt/csw/netsnmp/sbin/snmpd –c /opt/csw/netsnmp/share/snmp/snmpd.conf
进行测试
/opt/csw/netsnmp/bin/snmpwalk –v 2c –c public(这个字符串参照你进行初始配置时的字符串) 127.0.0.1 if
你应该可以看到一长串的信息
使SNMP成为服务
touch /etc/rc3.d/S99netsnmp
vi /etc/rc3.d/S99netsnmp

添加:/opt/csw/netsnmp/sbin/snmpd -c /opt/csw/netsnmp/share/snmp/snmpd.conf
保存退出

下载最新php源代码包www.php.net上传到服务器解压缩
gunzip -cd php-5.2.5.tar.gz | gtar xvpf –
cd php-5.2.5
./configure  --prefix=/opt/csw/php5 \
--with-config-file-path=/opt/csw/apache2 \
--with-apxs2=/opt/csw/apache2/sbin/apxs \
--enable-fastcgi \
--enable-force-cgi-redirect \
--with-layout=GUN \
--with-libxml-dir=/opt/csw \
--with-openssl=/opt/csw \
--with-zlib=/opt/csw \
--enable-bcmath \
--with-bz2 \
--enable-calendar \
--with-curl=/opt/csw \
--with-curlwrappers \
--enable-dbase \
--enable-exif \
--enable-ftp \
--with-pcre-dir=/opt/csw \
--with-openssl-dir=/opt/csw \
--with-gd=/opt/csw \
--with-jpeg-dir=/opt/csw \
--with-png-dir=/opt/csw \
--with-zlib-dir=/opt/csw \
--with-xpm-dir=/opt/csw \
--with-freetype-dir=/opt/csw \
--with-t1lib=/opt/csw \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext=/opt/csw \
--with-gmp=/opt/csw \
--enable-mbstring \
--with-mysql=shared,/opt/csw/mysql5 \
--with-mysqli=shared,/opt/csw/mysql5/bin/mysql_config \
--with-ncurses=/opt/csw \
--with-readline=/opt/csw \
--enable-shmop \
--with-snmp=shared,/opt/csw/netsnmp \
--enable-soap \
--enable-sockets \
--with-iconv-dir=/opt/csw \
--enable-zip复制配置文件到/opt/csw/apache2
cp php.ini-dist /opt/csw/apache2/php.ini
编辑php.ini
vi /opt/csw/apache2/php.ini
找到
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
修改include_path = ".:/php/includes” 为
include_path = "/opt/csw/php5/include/php/:/opt/csw/php5/lib/php/"
创建扩展路径
1. 验证生成 PHP 5 时是否创建了所需的模块:
#ls -l /opt/csw/php5/lib/php/extensions/no-debug-non-zts-20060613/
total 1712
-rwxr-xr-x   1 root     root       89360 Apr 24 01:50 iconv.so
-rwxr-xr-x   1 root     root      117812 Apr 24 01:50 mysql.so
-rwxr-xr-x   1 root     root      444292 Apr 24 01:50 mysqli.so
-rwxr-xr-x   1 root     root      188072 Apr 24 01:50 ncurses.so查找 php.ini 中以下列内容开头的行:
; Directory in which the loadable extensions (modules) reside.
extension_dir =
将该行编辑为以下内容:
extension_dir = "/opt/csw/php5/lib/php/extensions/no-debug-non-zts-20060613"
如果您已将 PHP 5 安装到其他位置,请根据需要调整此行。
2. 接下来查找 php.ini 文件的以下块:
  ;;;;;;;;;;;;;;;;;;;;;;
  ; Dynamic Extensions ;
  ;;;;;;;;;;;;;;;;;;;;;;
添加以下行:
  
extension=mysql.so
extension= mysqli.so
extension=snmp.so

现在,将不会发生 Apache/PHP 5 无法与 MySQL 连接的问题。
编辑apache配置文件
vi /opt/csw/apache2/etc/httpd.conf
找到
    DirectoryIndex  index.html
修改成
    DirectoryIndex  index.php index.html
找到
  #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在下面加入
AddType application/x-httpd-php .php
保存退出重启apache服务
svcadm restart cswapache2
创建cacti用户
#groupadd -g 120 cacti
#useradd -u 120 -g cacti -s /bin/bash -d /export/home/cacti -m cacti
#passwd cacti
编辑apache配置文件修改运行apache的用户和组
vi /opt/csw/apache2/etc/httpd.conf
找到
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nobody

# 'Main' server configuration
修改成为
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User cacti
Group cacti
保存退出重启服务
安装ZendOptimizer,下载对应操作系统版本解压后输入./install根据提示安装即可
安装phpadmin
从http://www.phpmyadmin.net/home_page/downloads.php下载安装包最新版本
用ftp上传至Solaris
解压缩并移动目录至web的根目录然后重命名为phpMyAdmin
#cd 你上传的目录
#gunzip2 phpMyAdmin-2.11.5.1-all-languages.tar.bz2
#tar –xvf phpMyAdmin-2.11.5.1-all-languages.tar
#mv phpMyAdmin-2.11.5.1-all-languages /opt/coolstack/apache2/ htdocs/phpMyAdmin
进入phpMyAdmin目录修改配置文件
#cd /opt/coolstack/apache2/ htdocs/phpMyAdmin
#cp config.sample.inc.php config.inc.php
#vi config.inc.php
修改前:
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
修改后:
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
打开浏览器输入http://你的IP/phpMyAdmin
利用mysql的超级用户和密码进行登陆
至此,solaris10下的amp环境搭建成功。
开始安装软件rrdtool,cacti:
Rrdtool通过网络安装
   Pkg-get –I rrdtool
   安装Cacti:
从www.cacti.net上下载最新版本0.87b,上传到服务器解压缩重命名移动到web的根目录
#gunzip cacti-0.8.7b.tar.gz
#tar –xvf cacti-0.8.7b.tar
#mv cacti-0.8.7b
/opt/coolstack/apache2/htdocs/cacti
导入cacti的数据库:(如果你按照我上面的方法安装了phpmyadmin便可以方便的在web里面进行数据库操作,这里介绍下使用命令导入)
#mysql –uroot –p
mysql> create database cacti;
mysql> use cacti;
mysql> source /你的cacti目录/cacti.sql;
mysql> grant all on cacti.* to cactiuser@localhost identified by '你的密码'; (创建帐号并赋予这个账号完全使用cacti数据库的权力)
mysql> flush privileges;
编辑修改cacti的数据库连接配置文件:
#vi /opt/coolstack/apache2/htdocs/cacti/include/config.php
$database_type = "mysql";
$database_default = "你创建的数据库名字";
$database_hostname = "localhost";
$database_username = "你创建的用户";
$database_password = "你的数据库密码";
$database_port = "3306";  

改变cacti文件夹内rra和log2个目录的权限,进入cacti目录
chown -R cacti:cacti rra/ log/

设置计划任务(必须以cacti用户登陆)
登入cacti用户设置计划任务
0,5,10,15,20,25,30,35,40,45,50,55 * * * *  /opt/csw/php5/bin/php /opt/csw/apache2/share/htdocs/cacti/poller.php > /dev/null 2>&1



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/68621/showart_681740.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP