📜 ⬆️ ⬇️

HowTo: Cacti 0.8.7g + Plugin Architecture 2.9 + Spine 0.8.7g on CentOS 5.5 i386

cacti
Cacti is a web application that will help you monitor the status of your server, CISCO and everything that can send data via the SNMP protocol. You can monitor the server CPU load, see on the chart the average memory load for a period of time, the number of DNS requests coming to the server, the number of letters (spam) coming to the mail server. You can monitor the average load on the network during working hours and much more.

Cacti Plugin Architecture is an add-on for Cacti that extends the capabilities of the standard package by incorporating the installation of third-party plug-ins.

Spine is a fast and high quality poller for Cacti written in C. It is used instead of the standard poller coming in the standard Cacti installation, cmd.php.
')
Indicative, basic installation Cacti with pribombasy CentOS 5.5 i386. Many elements of the web server security settings are ignored due to the test installation. All actions will be performed under the root.

Let's start with the installation of the LAMP basic web server.

Install the RPMforge repository:
rpm -Uhv apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Update the system and reboot:
yum -y update
reboot

Install the standard packages for the web server:
yum install -y mysql mysql-server mysql-devel httpd httpd-devel php php-mysql php-gd phpimap
php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt curl curl-devel perl-libwwwperl
libxml2 php-mbstring phpmyadmin

Setting up MySQL server:
chkconfig mysqld on
service mysqld start
mysql_secure_installation

Enter the last command, carefully read and follow the points of its output. In the end, you will have to set a password for MySQL root, allow external connections to the server, disable anonymous user, remove the test database, update the server records.

Apache configuration, httpd:
chkconfig httpd on
service httpd start


Setting up phpMyAdmin:
vim /etc/httpd/conf.d/phpmyadmin.conf

#
# Web application to manage MySQL
#
#<Directory "/usr/share/phpmyadmin">
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#

Alias ​​/ phpmyadmin / usr / share / phpmyadmin
Alias ​​/ phpMyAdmin / usr / share / phpmyadmin
Alias ​​/ mysqladmin / usr / share / phpmyadmin

vim /usr/share/phpmyadmin/config.inc.php

Find the following line (in my case it is 17th):
$cfg['blowfish_secret'] = '';

Follow this link and copy the generated secret blowfish. Insert it at the end, between single quotes. Example:
$cfg['blowfish_secret'] = '85NoZZ8_y})SzG5{ys1_#YEQoxwC*sn02%JhcK@WA';

Restart httpd:
service httpd restart


Let's start the installation of Cacti itself.

Install the dependencies needed by Cacti:
yum install -y net-snmp net-snmp-utils rrdtool php-snmp

Add to autoload and run SNMP service:
chkconfig snmpd on
service snmpd start

Download Cacti Packages:
wget www.cacti.net/downloads/cacti-0.8.7g.tar.gz
wget www.cacti.net/downloads/pia/cacti-plugin-0.8.7g-PA-v2.9.tar.gz
wget www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz

Unzip them:
tar -xzvf cacti-0.8.7g.tar.gz
tar -xzvf cacti-plugin-0.8.7g-PA-v2.9.tar.gz
tar -xzvf cacti-spine-0.8.7g.tar.gz

Create a working Cacti folder on the server:
mkdir /var/www/cacti

Copy the contents of the unpacked folder Cacti to the working folder Cacti:
cp -rf cacti-0.8.7g/* /var/www/cacti/

Create a user system for Cacti and give it the appropriate rights:
useradd -c CactiUser -d /var/www/cacti/ -s /sbin/nologin cactiuser
chown -R root /var/www/cacti ( Cacti )
chown -R cactiuser /var/www/cacti/log /var/www/cacti/rra

Create a database for Cacti with privileges for cactiuser:
mysql -u root -p
Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 55
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipassword';
mysql> flush privileges;
mysql> quit

Import the Cacti structure into its base:
mysql -u cactiuser -p cacti < /var/www/cacti/cacti.sql
Enter password: (cactipassword)

Set up Cacti's access to its database:
vim /var/www/cacti/include/config.php

$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipassword";
$database_port = "3306";

Go to the working directory of Cacti and fix the fixes with official patches:
cd /var/www/cacti

wget www.cacti.net/downloads/patches/0.8.7g/data_source_deactivate.patch
wget www.cacti.net/downloads/patches/0.8.7g/graph_list_view.patch
wget www.cacti.net/downloads/patches/0.8.7g/html_output.patch
wget www.cacti.net/downloads/patches/0.8.7g/ldap_group_authenication.patch
wget www.cacti.net/downloads/patches/0.8.7g/script_server_command_line_parse.patch
wget www.cacti.net/downloads/patches/0.8.7g/ping.patch
wget www.cacti.net/downloads/patches/0.8.7g/poller_interval.patch
patch -p1 -N < data_source_deactivate.patch
patch -p1 -N < graph_list_view.patch
patch -p1 -N < html_output.patch
patch -p1 -N < ldap_group_authenication.patch
patch -p1 -N < script_server_command_line_parse.patch
patch -p1 -N < ping.patch
patch -p1 -N < poller_interval.patch

Back in the home directory:
cd

Create cacti.conf to enable web access:
vim /etc/httpd/conf.d/cacti.conf

Alias /cacti /var/www/cacti
<Directory /var/www/cacti/>
DirectoryIndex index.php
Options -Indexes
AllowOverride all
order deny,allow
deny from all
allow from 192.168.1.0/24 (you can do it like "allow from all")
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on


Restart Apache:
service httpd restart

Create a cron task for Cacti:
vim /etc/cron.d/cacti
*/5 * * * * cactiuser php /var/www/cacti/poller.php > /dev/null 2>&1

From this point on, you can start using the basic Cacti installation in production, but let's install additional, not unnecessary functionality.

Cacti Plugin Architecture.

Copy the .diff patch architecture file to the Cacti working directory:
cp cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.9.diff /var/www/cacti/

Go to the working folder Cacti and perform a test patch application, in order to see if there is any interference:
cd /var/www/cacti/

patch -p1 -N --dry-run < cacti-plugin-0.8.7g-PA-v2.9.diff

The test should go bang, except for one line, but this is not a problem:
patching file include / config.php
Hunk # 1 succeeded at 30 with fuzz 1.

After making sure that the patch process should not cause any problems, apply the patch itself:
patch -p1 -N < cacti-plugin-0.8.7g-PA-v2.9.diff

Edit the Cacti configuration file:
vim /var/www/cacti/include/config.php

Find the next line and be sure to enter into it the working directory of Cacti (starting with the root of the web server folder). In our case it will look like this:
$url_path = "/cacti/";

Import additional plugin architecture base schema into the Cacti database:
mysql -u cactiuser -p cacti < /root/cacti-plugin-arch/pa.sql
Enter password: (cactipassword)


Let's go to the installation of Spine.

Install the dependencies needed when compiling Spine:
yum install -y net-snmp-devel

Go to the unzipped Spine folder and start compiling:
cd /root/cacti-spine-0.8.7g
./configure --prefix=
make
make install

Rename the spine configuration file:
mv /etc/spine.conf.dist /etc/spine.conf

Let's allow spine access to the Cacti database:
vim /etc/spine.conf

DB_Host localhost
DB_Database cacti
DB_User cactiuser
DB_Pass cactipassword
DB_Port 3306
DB_PreG 0


At last we will come on a page of our Cacti server / cacti .
We will see a couple of pages of the process of "installation" cacti. Click Next twice and Finish third time.
Login to console: admin / admin
imageimageimage
Go to the Settings page, then to the Paths tab.
At the bottom of the page, let us prescribe to the Spine binary. In our case:
/bin/spine

image

Then go to the tab Poller and set in the graph Poller Type - spine.
image

To enable Plugin Management, you need to go to the User Management page, the Realm Permissions tab and put the bird next to Plugin Management.
Persist.

And in the end let's try to put one plugin.
Go to the plugins folder in the Cacti directory:
cd /var/www/cacti/plugins

Download and unzip the plugin archive:
wget docs.cacti.net/_media/plugin:settings-v0.7-1.tgz
mv -f plugin:settings-v0.7-1.tgz settings-v0.7-1.tgz
tar -xzvf settings-v0.7-1.tgz


After these steps, go back to the Cacti management console, to the Plugin Management page.
Install and enable the plugin.

That's all.

Thank you for your attention and patience.

UPD .:
This is the standard graphics at the end of our installation. A space in the chart because I didn’t immediately make this screenshot and turned off the virtual machine. Below is a screen from the working system.

image

image

Source: https://habr.com/ru/post/115493/


All Articles