Observium Install on CentOS 7.x: Difference between revisions
No edit summary |
|||
(17 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
Refer to [[Firewall_for_Linux]] | Refer to [[Firewall_for_Linux]] | ||
= | = Prerequisite Repositories = | ||
<pre> | <pre> | ||
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |||
rpm | yum install https://mirror.webtatic.com/yum/el7/webtatic-release.rpm | ||
yum install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm | |||
</pre> | </pre> | ||
= Package Installs = | = Package Installs = | ||
<pre> | <pre> | ||
yum | yum install wget httpd php70w php70w-opcache php70w-mysql php70w-gd php70w-posix php70w-mcrypt php70w-pear net-snmp net-snmp-utils fping mariadb-server mariadb MySQL-python rrdtool subversion jwhois ipmitool graphviz ImageMagick | ||
</pre> | </pre> | ||
<pre> | <pre> | ||
Line 21: | Line 22: | ||
= Observium Install = | = Observium Install = | ||
== Community Install == | |||
<pre> | <pre> | ||
cd /opt | cd /opt | ||
Line 26: | Line 28: | ||
tar zxvf observium-community-latest.tar.gz | tar zxvf observium-community-latest.tar.gz | ||
rm -f observium-community-latest.tar.gz | rm -f observium-community-latest.tar.gz | ||
</pre> | |||
== Monthly Stable Install == | |||
Paid version. At time of writing £150 (pounds) per year. | |||
<pre> | |||
cd /opt | |||
svn co http://svn.observium.org/svn/observium/branches/stable observium | |||
</pre> | </pre> | ||
Line 51: | Line 60: | ||
<pre> | <pre> | ||
// Database config --- This MUST be configured | // Database config --- This MUST be configured | ||
$config['db_host'] = 'localhost'; | $config['db_extension'] = 'mysqli'; | ||
$config['db_user'] = 'myobservium'; | $config['db_host'] = 'localhost'; | ||
$config['db_pass'] = 'somerandompassword'; | $config['db_user'] = 'myobservium'; | ||
$config['db_name'] = 'observium'; | $config['db_pass'] = 'somerandompassword'; | ||
$config['db_name'] = 'observium'; | |||
</pre> | </pre> | ||
Line 73: | Line 83: | ||
= Populate SQL Database = | = Populate SQL Database = | ||
<pre> | <pre> | ||
php /opt/observium/ | php /opt/observium/discovery.php -u | ||
</pre> | </pre> | ||
Line 114: | Line 124: | ||
Add the following Lines | Add the following Lines | ||
<pre> | <pre> | ||
30 4 * * * /opt/observium/discovery.php -h all >> /dev/null 2>&1 | |||
*/5 * * * * /opt/observium/poller-wrapper.py | */5 * * * * /opt/observium/poller-wrapper.py 15 >> /dev/null 2>&1 | ||
22 2 * * * /opt/observium/housekeeping.php -ay | |||
</pre> | |||
= Housekeeping = | |||
<pre> | |||
vi /opt/observium/config.php | |||
</pre> | |||
Add the following | |||
<pre> | |||
// Purge log files | |||
// in seconds before automatically purging; 0 to disable (i.e. 30*86400 for 30 days.) | |||
$config['housekeeping']['deleted_ports']['age'] = 604800; // 7 Days | |||
$config['housekeeping']['syslog']['age'] = 5184000; // 60 Days | |||
$config['housekeeping']['eventlog']['age'] = 7776000; // 90 Days | |||
$config['housekeeping']['rrd']['age'] = 7776000; // 90 Days | |||
$config['housekeeping']['rrd']['invalid'] = TRUE; | |||
$config['housekeeping']['timing']['age'] = 604800; // 7 Days | |||
</pre> | </pre> | ||
Line 124: | Line 154: | ||
</pre> | </pre> | ||
'''NOTE''': It seems that | '''NOTE''': It seems that using WMI to monitor storage stops the graphing of disk usage. If you disable disk monitoring in WMI and enable in modules so that disk graphing is done by SNMP data rather than WMI seems to fix this problem. | ||
<pre> | |||
vi /opt/observium/config.php | |||
</pre> | |||
<pre> | |||
// Enable default WMI Paramaters | |||
$config['wmi']['domain'] = "domainname"; // NetBIOS Name Shorthand Domain/Workgroup (ie. notdomain.local.com) | |||
$config['wmi']['user'] = "useraccount"; | |||
$config['wmi']['pass'] = "passw0rd"; | |||
$config['wmi']['modules']['storage'] = 0; | |||
$config['poller_modules']['wmi'] = 1; | |||
</pre> | |||
= Syslog Server = | |||
<pre> | |||
yum install rsyslog | |||
systemctl enable rsyslog | |||
systemctl start rsyslog | |||
</pre> | |||
<pre> | |||
vi /etc/rsyslog.conf | |||
</pre> | |||
Uncommment the following lines | |||
<pre> | |||
$ModLoad imudp | |||
$UDPServerRun 514 | |||
</pre> | |||
Add the following to the end of the file. | |||
<pre> | |||
# Always use full names with domain part | |||
$PreserveFQDN on | |||
</pre> | |||
Create a new file | |||
<pre> | |||
touch /etc/rsyslog.d/30-observium.conf | |||
</pre> | |||
add the following lines | |||
<pre> | |||
vi /etc/rsyslog.d/30-observium.conf | |||
</pre> | |||
<pre> | |||
#--------------------------------------------------------- | |||
#send remote logs to observium | |||
$template observium,"%fromhost%||%syslogfacility%||%syslogpriority%||%syslogseverity%||%syslogtag%||%$year%-%$month%-%$day% %timereported:8:25%||%msg%||%programname%\n" | |||
$ModLoad omprog | |||
$ActionOMProgBinary /opt/observium/syslog.php | |||
:inputname, isequal, "imudp" :omprog:;observium | |||
& ~ | |||
# & stop | |||
#--------------------------------------------------------- | |||
</pre> | |||
Enable Syslog in Observium | |||
<pre> | |||
vi /opt/observium/config.php | |||
</pre> | |||
<pre> | |||
// Enable Syslog | |||
$config['enable_syslog'] = 1; | |||
$config['syslog']['debug'] = TRUE; | |||
</pre> | |||
<pre> | |||
systemctl restart rsyslog | |||
</pre> | |||
= PHP Timezone = | = PHP Timezone = | ||
Line 140: | Line 248: | ||
= Additional Packages = | = Additional Packages = | ||
<pre> | <pre> | ||
yum -y install mtr nmap libvirt-client | yum -y install mtr nmap libvirt-client | ||
</pre> | </pre> | ||
Add the following line as Observium by default will look for /usr/bin/mtr | Add the following line as Observium by default will look for /usr/bin/mtr | ||
<pre> | <pre> | ||
vi / | vi /opt/observium/config.php | ||
</pre> | </pre> | ||
Latest revision as of 00:49, 15 February 2017
Disable Firewall and selinux
This is a choice you'll have to make if you want these disabled.
Refer to Firewall_for_Linux
Prerequisite Repositories
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install http://yum.opennms.org/repofiles/opennms-repo-stable-rhel7.noarch.rpm
Package Installs
yum install wget httpd php70w php70w-opcache php70w-mysql php70w-gd php70w-posix php70w-mcrypt php70w-pear net-snmp net-snmp-utils fping mariadb-server mariadb MySQL-python rrdtool subversion jwhois ipmitool graphviz ImageMagick
systemctl enable mariadb systemctl enable httpd systemctl start mariadb systemctl start httpd
Observium Install
Community Install
cd /opt wget http://www.observium.org/observium-community-latest.tar.gz tar zxvf observium-community-latest.tar.gz rm -f observium-community-latest.tar.gz
Monthly Stable Install
Paid version. At time of writing £150 (pounds) per year.
cd /opt svn co http://svn.observium.org/svn/observium/branches/stable observium
Create SQL Database
The below is using a username of myobservium and a password of somerandompassword
mysql CREATE DATABASE observium DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON observium.* TO 'myobservium'@'localhost' IDENTIFIED BY 'somerandompassword'; flush privileges; exit
Config File
cd /opt/observium cp config.php.default config.php
vi config.php
Modify Entries
// Database config --- This MUST be configured $config['db_extension'] = 'mysqli'; $config['db_host'] = 'localhost'; $config['db_user'] = 'myobservium'; $config['db_pass'] = 'somerandompassword'; $config['db_name'] = 'observium';
Add entry
$config['fping'] = "/usr/sbin/fping"; $config['fping6'] = "/usr/sbin/fping6";
Create Config Folders
mkdir logs mkdir rrd chown apache:apache logs chown apache:apache rrd
Populate SQL Database
php /opt/observium/discovery.php -u
Create Apache WEB Site
vi /etc/httpd/conf/httpd.conf
Add the following to the end of the file
<VirtualHost *:80> 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>
Create Admin User
/opt/observium/adduser.php <username> <password> 10
Add Device
This command is for the CLI but can be done from the WEB interface
/opt/observium/add_device.php <hostname> <community> v2c
Cron Job
crontab -e
Add the following Lines
30 4 * * * /opt/observium/discovery.php -h all >> /dev/null 2>&1 */5 * * * * /opt/observium/poller-wrapper.py 15 >> /dev/null 2>&1 22 2 * * * /opt/observium/housekeeping.php -ay
Housekeeping
vi /opt/observium/config.php
Add the following
// Purge log files // in seconds before automatically purging; 0 to disable (i.e. 30*86400 for 30 days.) $config['housekeeping']['deleted_ports']['age'] = 604800; // 7 Days $config['housekeeping']['syslog']['age'] = 5184000; // 60 Days $config['housekeeping']['eventlog']['age'] = 7776000; // 90 Days $config['housekeeping']['rrd']['age'] = 7776000; // 90 Days $config['housekeeping']['rrd']['invalid'] = TRUE; $config['housekeeping']['timing']['age'] = 604800; // 7 Days
WMI
If you wish to gather further information from Windows computers using WMI then you will need the following, along with the appropriate configuration and enabling of WMI in Observium
rpm -Uvh http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/wmi-1.3.14-4.el7.art.x86_64.rpm
NOTE: It seems that using WMI to monitor storage stops the graphing of disk usage. If you disable disk monitoring in WMI and enable in modules so that disk graphing is done by SNMP data rather than WMI seems to fix this problem.
vi /opt/observium/config.php
// Enable default WMI Paramaters $config['wmi']['domain'] = "domainname"; // NetBIOS Name Shorthand Domain/Workgroup (ie. notdomain.local.com) $config['wmi']['user'] = "useraccount"; $config['wmi']['pass'] = "passw0rd"; $config['wmi']['modules']['storage'] = 0; $config['poller_modules']['wmi'] = 1;
Syslog Server
yum install rsyslog systemctl enable rsyslog systemctl start rsyslog
vi /etc/rsyslog.conf
Uncommment the following lines
$ModLoad imudp $UDPServerRun 514
Add the following to the end of the file.
# Always use full names with domain part $PreserveFQDN on
Create a new file
touch /etc/rsyslog.d/30-observium.conf
add the following lines
vi /etc/rsyslog.d/30-observium.conf
#--------------------------------------------------------- #send remote logs to observium $template observium,"%fromhost%||%syslogfacility%||%syslogpriority%||%syslogseverity%||%syslogtag%||%$year%-%$month%-%$day% %timereported:8:25%||%msg%||%programname%\n" $ModLoad omprog $ActionOMProgBinary /opt/observium/syslog.php :inputname, isequal, "imudp" :omprog:;observium & ~ # & stop #---------------------------------------------------------
Enable Syslog in Observium
vi /opt/observium/config.php
// Enable Syslog $config['enable_syslog'] = 1; $config['syslog']['debug'] = TRUE;
systemctl restart rsyslog
PHP Timezone
By default the Apache server does not recognise the time zone that your server is located. You will need to ensure that you configure PHP for the correct timezone.
vi /etc/php.ini
date.timezone = Australia/Brisbane
For a complete list of timezones.
Additional Packages
yum -y install mtr nmap libvirt-client
Add the following line as Observium by default will look for /usr/bin/mtr
vi /opt/observium/config.php
$config['mtr'] = "/usr/sbin/mtr";