lamp observium snmp

[[email protected] ~]# rpm -ivh https://mirror.webtatic.com/yum/el6/latest.rpm [[email protected] ~]# rpm -ivh epel-release-6-8.noarch.rpm [[email protected] ~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm


[[email protected] ~]# rpm -ivh http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
[[email protected] ~]# yum install -y mysql-community-server 
[[email protected] ~]# vi /etc/my.cnf
[mysqld]
port = 3306
user = mysql
character-set-server=utf8
explicit_defaults_for_timestamp
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
open-files-limit = 65535

max_connections = 500
max_connect_errors = 10000

key_buffer_size = 256M
max_allowed_packet = 16M

read_buffer_size = 1M
read_rnd_buffer_size = 1M
sort_buffer_size = 1M
join_buffer_size = 1M

tmp_table_size = 256M
max_heap_table_size = 256M

table_open_cache = 512
thread_cache_size = 64

slow_query_log = 1
long_query_time = 5
log-queries-not-using-indexes

log_bin = mysql-bin
binlog_format = row
sync_binlog = 1
binlog_cache_size = 16M
max_binlog_cache_size = 32M
max_binlog_size = 512M
expire_logs_days = 7

relay_log = relay-bin
relay_log_recovery = 1

master_info_repository = table
relay_log_info_repository = table

innodb_buffer_pool_size = 2G
innodb_buffer_pool_instances = 2
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_log_buffer_size = 16M
innodb_undo_logs= 128
innodb_undo_tablespaces = 3
innodb_file_format = Barracuda
innodb_strict_mode = 1
innodb_data_file_path = ibdata1:1024M:autoextend

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
default-character-set = utf8

[client]
default-character-set = utf8
[[email protected] ~]# service mysqld start
[[email protected] ~]# mysql_secure_installation


[[email protected] ~]# mysql -uroot -pabcd.1234
mysql> create database observium default character set utf8;
mysql> grant all on observium.* to 'observium'@'localhost' identified by 'observium';
mysql> flush privileges;


[[email protected] ~]# yum install -y httpd.x86_64 php56w.x86_64 php56w-opcache.x86_64 php56w-mysql.x86_64 php56w-gd.x86_64 php56w-posix php56w-mcrypt.x86_64 php56w-pear.noarch cronie.x86_64 net-snmp.x86_64 net-snmp-utils.x86_64 fping.x86_64 MySQL-python.x86_64 rrdtool.x86_64 jwhois.x86_64 ipmitool.x86_64 graphviz.x86_64 ImageMagick.x86_64


[[email protected] ~]# tar zxvf observium-community-latest.tar.gz 
[[email protected] ~]# mv observium /usr/local/
[[email protected] ~]# cd /usr/local/observium/
[[email protected] observium]# cp config.php.default config.php
[[email protected] observium]# vi config.php
$config['db_extension'] = 'mysqli';
$config['db_host']      = 'localhost';
$config['db_user']      = 'observium';
$config['db_pass']      = 'observium';
$config['db_name']      = 'observium';

$config['fping'] = "/usr/sbin/fping";

$config['frontpage']['order'] = array('status_summary',
                                      'device_status_boxes', 'device_status',
                                      'eventlog');


[[email protected] observium]# ./discovery.php -u

  ___   _                              _
 / _ \ | |__   ___   ___  _ __ __   __(_) _   _  _ __ ___
| | | || '_ \ / __| / _ \| '__|\ \ / /| || | | || '_ ` _ | |_| || |_) |\__ \|  __/| |    \ V / | || |_| || | | | | |
 \___/ |_.__/ |___/ \___||_|     \_/  |_| \__,_||_| |_| |_|
                         Observium Community Edition 17.9.0
                                   http://www.observium.org

Install initial database schema ... done.
-- Updating database/file schema
310 -> 311 # (db) . Done (0s).
311 -> 312 # (db) .... Done (0s).
312 -> 313 # (db)  Done (0s).
313 -> 314 # (db)  Done (0s).
314 -> 315 # (php) . Done (1s).
315 -> 316 # (db) . Done (0s).
316 -> 317 # (db) .. Done (0s).
317 -> 318 # (db) . Done (0s).
318 -> 319 # (db) ....... Done (1s).
319 -> 320 # (db) . Done (0s).
320 -> 321 # (db) . Done (0s).
321 -> 322 # (db) . Done (0s).
322 -> 323 # (db) ... Done (0s).
323 -> 324 # (db) ... Done (1s).
324 -> 325 # (db) .... Done (1s).
325 -> 326 # (db) . Done (0s).
326 -> 327 # (db) . Done (0s).
327 -> 328 # (db) . Done (0s).
328 -> 329 # (db) . Done (0s).
329 -> 330 # (db) . Done (0s).
330 -> 331 # (db) . Done (0s).
331 -> 332 # (db) ... Done (1s).
332 -> 333 # (php)  Done (0s).
333 -> 334 # (db) . Done (1s).
334 -> 335 # (php)  Done (0s).
335 -> 336 # (db) . Done (0s).
336 -> 337 # (db) . Done (0s).
337 -> 338 # (db) . Done (0s).
338 -> 339 # (db) ... Done (1s).
339 -> 340 # (db) ... Done (0s).
340 -> 341 # (db) ........ Done (0s).
341 -> 342 # (db) ............... Done (1s).
342 -> 343 # (db) ... Done (0s).
343 -> 344 # (db) .... Done (1s).
344 -> 345 # (db) .. Done (0s).
345 -> 346 # (db) . Done (0s).
346 -> 347 # (db) . Done (0s).
347 -> 348 # (db) F Done (0s, 1 errors).
348 -> 349 # (db) .. Done (0s).
349 -> 350 # (php)  Done (0s).
350 -> 351 # (db) ..... Done (0s).
351 -> 352 # (db) .. Done (0s).
-- Done.

[[email protected] observium]# ./adduser.php admin abcd.1234 10
Observium CE 17.9.0
Add User

User admin added successfully.

[[email protected] observium]# mkdir rrd
[[email protected] observium]# mkdir logs
[[email protected] observium]# chown apache.apache rrd logs


[[email protected] ~]# vi /etc/httpd/conf.d/observium.conf 
<VirtualHost *>
   DocumentRoot /usr/local/observium/html/
   CustomLog /usr/local/observium/logs/access_log combined
   ErrorLog /usr/local/observium/logs/error_log
   <Directory "/usr/local/observium/html/">
     AllowOverride All
     Options FollowSymLinks MultiViews
   </Directory>
</VirtualHost>

[[email protected] ~]# service httpd restart


[[email protected] ~]# crontab -e
# Run a complete discovery of all devices once every 6 hours
30 */6 * * *  /usr/local/observium/discovery.php -h all >> /dev/null 2>&1
# Run automated discovery of newly added devices every 5 minutes
*/5 * * * * /usr/local/observium/discovery.php -h new >> /dev/null 2>&1
# Run multithreaded poller wrapper every 5 minutes
*/5 * * * * /usr/local/observium/poller-wrapper.py 8 >> /dev/null 2>&1


開源監控解決方案:Observium部署實錄