[root@localhost httpd-2.2.8]# /usr/local/mysql/bin/mysql -u root -pmysql mysql> create database cactidb; mysql> grant all on cactidb.* to root; mysql> grant all on cactidb.* to root@localhost; mysql> grant all on cactidb.* to cactiuser; mysql> grant all on cactidb.* to cactiuser@localhost; mysql> set password for cactiuser@localhost=password('cactipw'); 注:以上语句输出 Query OK, 0 rows affected (0.01 sec) 表示成功 mysql> exit Mysql设置完毕 检测apache + php + mysql [root @tsai usr]# cd /www/htdocs [root @tsai htdocs]# touch info.php [root @tsai htdocs]# vi info.php
$link=mysql_connect('localhost','root'); mysql_select_db('mysql'); $str="select * from user;"; $result=mysql_query($str,$link); $show=mysql_num_rows($result); mysql_close($link); for ($i=0;$i < $show;$i++) { $arr[$i]=mysql_fetch_array($result); }; ?>
Host
User
Password
};?>
保存退出 :wq
重启mysql + apache 服务 [root @localhost htdocs]# service mydql restart [root @localhost htdocs]# service httpd restart 进入浏览器检查 和
安装rrdtool
[root@localhost usr]# tar zxvf rrdtool-1.0.50.tar.gz [root@localhost usr]# cd rrdtool-1.0.50 [root@localhost rrdtool-1.0.50]# ./configure [root@localhost rrdtool-1.0.50]# make && make install
我的是fedora 7,用下面的方法。
[root@localhost usr] yum install rrdtool
Rrdtool安装完毕
安装net-snmp、snmpwalk和snmpget命令
[root@localhost usr]# rpm -qa | grep net-snmp net-snmp-5.0.9-2.30E.15 net-snmp-devel-5.0.9-2.30E.15 net-snmp-libs-5.0.9-2.30E.15 net-snmp-utils-5.0.9-2.30E.15 [root@localhost usr]# vi /etc/snmp/snmpd.conf 更改 1、com2sec notConfigUser default public 改为:com2sec notConfigUser 127.0.0.1 public 2、access notConfigGroup "" any noauth exact systemview none none 改为:access notConfigGroup "" any noauth exact all none none 3、#view all included .1 80 将前面的 # 注释 去掉。 保存退出 :wq [root@localhost usr]# service snmpd restart
或者使用:net-snmp-5.1.4.tar.gz安装 [root@localhost local]# tar -zxvf net-snmp-5.1.4.tar.gz [root@localhost local]# cd net-snmp-5.1.4 [root@localhost local]# ./configure [root@localhost local]# make [root@localhost local]# make install 运行snmpconf -g basic_setup,会在当前目录下生成一个snmpd.conf配置文件: [root@localhost local]# 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)
注:此时graphs还不能显示图形,需要将服务重新启动一下 [root@localhost scripts]# service snmpd restart [root@localhost scripts]# service mysql restart [root@localhost scripts]# service httpd restart