

setenforce 0
sed -i 's/^SELINUX=.*$/SELINUX=disabled/' /etc/selinux/config

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm


yum install yum-utils
yum-config-manager --enable remi-php72


yum install wget.x86_64 httpd.x86_64 php.x86_64 php-opcache.x86_64 php-mysql.x86_64 php-gd.x86_64 \
php-posix php-pear.noarch cronie.x86_64 net-snmp.x86_64 net-snmp-utils.x86_64 \
fping.x86_64 mariadb-server.x86_64 mariadb.x86_64 MySQL-python.x86_64 rrdtool.x86_64 \
subversion.x86_64 jwhois.x86_64 ipmitool.x86_64 graphviz.x86_64 ImageMagick.x86_64 \
php-sodium.x86_64

http://www.observium.org/observium-community-latest.tar.gz
mkdir -p /opt/observium && cd /opt
tar -zxf observium-community-latest.tar.gz

systemctl enable mariadb
systemctl start mariadb
/usr/bin/mysqladmin -u root password 'MySQL@2021'
mysql -uroot -pMySQL@2021
CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON observium.* TO 'observium'@'localhost' IDENTIFIED BY 'observium@2021';
exit;

cp config.php.default config.php
vi config.php
修改数据库的账户与密码为上面设置的mariadb的账户与密码
$config['db_user'] = 'observium';
$config['db_pass'] = 'observium@2021';


./discovery.php -u

which fping
/usr/sbin/fping
vi config.php
$config['fping'] = "/usr/sbin/fping";

cd /opt/observium
mkdir rrd
chown apache:apache rrd
vi /etc/httpd/conf.d/observium.conf
<VirtualHost *>
DocumentRoot /opt/observium/html/
ServerName observium.domain.com
CustomLog /opt/observium/logs/access_log combined
ErrorLog /opt/observium/logs/error_log
<Directory "/opt/observium/html/">
AllowOverride All
Options FollowSymLinks MultiViews
Require all granted
</Directory>
</VirtualHost>
mkdir /opt/observium/logs
chown apache:apache /opt/observium/logs

vi /etc/cron.d/observium
# Run a complete discovery of all devices once every 6 hours
33 */6 * * * root /opt/observium/discovery.php -h all >> /dev/null 2>&1
# Run automated discovery of newly added devices every 5 minutes
*/5 * * * * root /opt/observium/discovery.php -h new >> /dev/null 2>&1
# Run multithreaded poller wrapper every 1 minutes
*/1 * * * * root /opt/observium/poller-wrapper.py >> /dev/null 2>&1
# Run housekeeping script daily for syslog, eventlog and alert log
13 5 * * * root /opt/observium/housekeeping.php -ysel
# Run housekeeping script daily for rrds, ports, orphaned entries in the database and performance data
47 4 * * * root /opt/observium/housekeeping.php -yrptb
systemctl reload crond

./adduser.php admin admin2021 10
systemctl enable httpd
systemctl start httpd
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

yum install net-snmp net-snmp-utils
systemctl enable snmpd
vi /etc/snmp/snmpd.conf
原先view systemview included .1.3.6.1.2.1.1
修改为
view systemview included .1.3.6.1.2.1
syslocation Unknown (edit /etc/snmp/snmpd.conf)
#syslocation Unknown (edit /etc/snmp/snmpd.conf)
syslocation HangZhou,Zhejiang,China
cat /etc/snmp/snmpd.conf | grep systemview
cat /etc/snmp/snmpd.conf | grep syslocation
systemctl start snmpd
netstat -anp | grep 161
firewall-cmd --permanent --zone=public --add-service=snmp
firewall-cmd --reload





./add_device.php <hostname> <community> v2c
Do an initial discovery and polling run to populate the data for the new device:
./discovery.php -h all
./poller.php -h all






// Enable Syslog
$config['enable_syslog'] = 1;




vi /etc/rsyslog.conf
最后行添加
*.* @192.168.31.84
systemctl restart rsyslog



原文作者:WalkingCloud;如有侵权,请联系管理员删除。