本文共 3337 字,大约阅读时间需要 11 分钟。
aptitude install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp \php-pear snmp graphviz subversion mysql-server mysql-client rrdtool \fping imagemagick whois mtr-tiny nmap ipmitool
安装 Net_IPv6
Install the IPv4 and IPv6 pear libraries:$ sudo pear install Net_IPv6$ sudo pear install Net_IPv4
安装observium软件
http://www.observium.org/observium-latest.tar.gz
$ wget http://www.observium.org/observium-latest.tar.gz$ tar zxvf observium-latest.tar.gz$ sudo mv observium /opt$ cd /opt/observium/$ cp config.php.default config.php$ sudo mkdir graphs rrd$ chown www-data.www-data graphs rrd$ mkdir /opt/observium/logs
创建数据库SQL脚本
CREATE DATABASE observium;GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost'IDENTIFIED BY '';
创建数据库
$ mysql -uroot -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 238145Server version: 5.1.41-3ubuntu12.10 (Ubuntu)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> CREATE DATABASE observium;Query OK, 1 row affected (0.10 sec)mysql> GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'observium';Query OK, 0 rows affected (0.06 sec)
修改配置文件
$ vim config.php### Database config$config['db_host'] = "localhost";$config['db_user'] = "observium";$config['db_pass'] = "observium";$config['db_name'] = "observium";### List of networks to allow scanning-based discovery$config['nets'][] = "172.16.1.0/24";$config['nets'][] = "172.16.3.0/24";or$config['nets'][] = "172.16.0.0/16";
创建数据库表
$ mysql -uobservium -pobservium observium < database-schema.sql
配置WEB服务器
$ sudo vim /etc/apache2/sites-available/observiumServerAdmin webmaster@localhost ServerName observium.domain.com DocumentRoot /opt/observium/html Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On
启用Rewrite
$ sudo a2enmod rewriteEnabling module rewrite.Run '/etc/init.d/apache2 restart' to activate new configuration!$ sudo a2ensite observiumEnabling site observium.Run '/etc/init.d/apache2 reload' to activate new configuration!$ sudo apache2ctl restart
添加用户
$ ./adduser.phpAdd User ToolUsage: ./adduser.php[email]$ ./adduser.php neo chen 1 neo.chen@example.com$ ./adduser.php netkiller 3655927 10 neo.chen@example.comUser netkiller added successfully$ ./addhost.phpObservium v0.11.9.2439 Add Host ToolUsage: ./addhost.php [community] [v1|v2c] [port] [udp|udp6|tcp|tcp6]$ ./addhost.php localhost public v2cTrying community publicAdded device localhost (1)
./discovery.php -h all./poller.php -h all
设置定时任务
$ crontab -e33 */6 * * * cd /opt/observium/ && ./discovery.php -h all >> /dev/null 2>&1*/5 * * * * cd /opt/observium/ && ./discovery.php -h new >> /dev/null 2>&1*/5 * * * * cd /opt/observium/ && ./poller.php -h all >> /dev/null 2>&1$ sudo /etc/init.d/cron reload
原文出处:Netkiller 系列 手札
本文作者:陈景峯 转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。