observium和librenms常用配置

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

Centos8切换到Stream版本

大致先更换vault源,然后执行切换升级。

# CentOS 8 
minorver=8.5.2111
#mirrors=https://mirrors.aliyun.com/centos-vault
mirrors=http://ftp.iij.ad.jp/pub/linux/centos-vault
sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" \
         -e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=$mirrors/$minorver|g" \
         -i.bak \
         /etc/yum.repos.d/CentOS-*.repo

然后dnf更新系统。

dnf install centos-release-stream -y
dnf swap centos-linux-repos centos-stream-repos -y
dnf distro-sync -y

Centos8 stream更换vault源

mirrors=http://ftp.iij.ad.jp/pub/linux/centos-vault/8-stream/
sed -e "s|^mirrorlist=|#mirrorlist=|g" -e "s|#baseurl=http://mirror.centos.org/\$contentdir/\$stream/|baseurl=$mirrors|" CentOS-Stream-AppStream.repo    \
 -i.bak /etc/yum.repos.d/CentOS-*.repo

 

可能有一些第三方包不能升级, 也有可能遇上centos-release-stream安装失败的情况。