librenms.conf nginx配置
server {
listen 80;
server_name librenms.XXX.com;
root /opt/librenms/html/;
index index.php;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {expires 30d;}
location ~ .*\.(js|css)?$ { expires 12h;}
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api/v0 { try_files $uri $uri/ /api_v0.php?$query_string; }
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/dev/shm/librenms.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
location ~ /\.ht { deny all; }
}
observium.conf nginx配置
server {
listen 80;
root /opt/observium/html/;
index index.php;
server_name observium.XXX.com;
error_log /var/log/nginx/observium.error.log ;
access_log /var/log/nginx/observium.log ;
location / { try_files $uri $uri/ /index.php?$query_string; }
location /api/v0 { try_files $uri $uri/ /api_v0.php?$query_string; }
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/dev/shm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
observium.sh 升级迭代版本
cd /opt
mv observium observium_old
wget http://www.observium.org/observium-community-latest.tar.gz -O -|tar xz
mv /opt/observium_old/{rrd,logs,config.php} /opt/observium/
/opt/observium/discovery.php -u
/opt/observium/discovery.php -h all
rm -rf observium_old
和observium很像,开源软件.
file bison mlocate flex diffutils
yum -y install cronie fping git ImageMagick whois mtr net-snmp net-snmp-utils nmap python-memcached rrdtool
useradd librenms -d /opt/librenms -M -r
cd /opt
git clone https://github.com/librenms/librenms.git
chown -R librenms:librenms /opt/librenms
chmod 770 /opt/librenms
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
runuser -l librenms -c '/opt/php7/bin/php /opt/librenms/scripts/composer_wrapper.php install --no-dev'
nginx配置
server {
listen 80;
root /opt/observium;
index index.php;
server_name observium.example.com;
error_log /var/log/nginx/observium.error.log ;
access_log /var/log/nginx/observium.log ;
location / {
location ~ .php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/dev/shm/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_read_timeout 300;
}
}
location ~/\.ht {
deny all;
}
}
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /api/v0 {
try_files $uri $uri/ /api_v0.php?$query_string;
}
location ~ \.php {
include fastcgi.conf;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/dev/shm/php-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
FPM配置文件
[librenms]
user = $pool
group = $pool
listen = /dev/shm/$pool.sock
listen.mode = 0666
pm = dynamic
pm.max_children = 15
pm.start_servers = 5
pm.min_spare_servers = 3
pm.max_spare_servers = 5
chdir = /opt/bgpto
security.limit_extensions = .php .php3 .php4 .php5 .php7
env[HOSTNAME] = $pool.hostname
env[PATH] = /usr/local/bin:/usr/bin:/bin:/opt/php7/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
php_admin_value[error_log] = /var/log/fpm-php.$pool.log
php_admin_value[memory_limit] = 256M