Supports server monitoring and Alarm System Shinken across the Platform

Source: Internet
Author: User

Supports server monitoring and Alarm System Shinken across the Platform
GuideShinken is an open-source host and network monitoring framework implemented in Python and is compatible with Nagios like. It can run on all operating systems that support Python programs, such as Linux, Unix, and Windows. Shinken is written by Jean Gabes to verify a new Nagios architecture idea.

In this tutorial, I will describe how to install Shinken from source code compilation and add a Linux host to the monitoring system. I will use Ubuntu 16.04 Xenial Xerus as the Shinken server and monitored host.

Step 1 install the Shinken Server

Shinken is a Python framework. We can install it through pip or from the source code. In this step, we will compile and install Shinken with the source code.

Several steps are required before installing Shinken.

Install some new Python software packages and createShinken system user:

sudo apt-get install python-setuptools python-pip python-pycurluseradd -m -s /bin/bash shinken

Download the Shinken source code from the GitHub Repository:

git clone https://github.com/naparuba/shinken.gitcd shinken/

Run the following command to install Shinken:

git checkout 2.4.3python setup.py install

Then, in order to get better results, we also need to install the python-cherrypy3 package from the Ubuntu software library:

sudo apt-get install python-cherrypy3

At this point, Shinken has been successfully installed. Next we will add Shinken to the system startup Item and start it:

update-rc.d shinken defaultssystemctl start shinken
Step 2 install Shinken Webui2

Webui2 is the Web interface of Shinken (which can be found in shinken. io ). The simplest way to install Shinken webui2 is to use the shinken CLI command (which must be executed as a shinken user ).

Switch to shinken User:

su - shinken

Initialize the shiken configuration file. The following command creates a new configuration file. shinken. ini:

shinken --init

Run the shinken CLI command to install webui2:

shinken install webui2

Now webui2 has been installed, but we still need to install MongoDB and pip to install another Python package. Run the following command under root:

sudo apt-get install mongodbpip install pymongo>=3.0.3 requests arrow bottle==0.12.8

Next, switch to the shinken directory and add this new webui2 module by editing the broker-master.cfg file:

cd /etc/shinken/brokers/vim broker-master.cfg

Add a module option in row 40th:

modules     webui2

Save the file and exit the editor.

Now go to the contacts directory and Edit admin. cfg to manage the configuration.

cd /etc/shinken/contacts/vim admin.cfg

Modify as follows:

contact_name    admin       # Username 'admin'password        yourpass    # Pass 'mypass'

Save and exit.

Step 3 install the Nagios plug-in and Shinken Software Package

In this step, we will install the Nagios plug-in and some Perl modules. Then install other software packages from shinken. io for monitoring.

Cpanminus required for installing the Nagios plug-in and Perl module:

sudo apt-get install nagios-plugins* cpanminus

Run the cpanm command to install the Perl module.

cpanm Net::SNMPcpanm Time::HiRescpanm DBI

Now we create a directory linking the utils. pm file to shinken and create a new log directory for Log_File_Health.

chmod u+s /usr/lib/nagios/plugins/check_icmpln -s /usr/lib/nagios/plugins/utils.pm /var/lib/shinken/libexec/mkdir -p /var/log/rhosts/touch /var/log/rhosts/remote-hosts.log

Then install the shinken Software Package ssh and linux-snmp from shinken. io to monitor SSH and SNMP:

su - shinkenshinken install sshshinken install linux-snmp
Step 4 Add a Linux host-one

We will add a new Linux host to be monitored. The IP address is 192.168.1.121 and the host name is host-one in Ubuntu 16.04.

Connect to the host-one host:

ssh host1@192.168.1.121

Install the snmp and snmpd software packages from the Ubuntu software library:

sudo apt-get install snmp snmpd

Then, use vim to edit the snmpd. conf configuration file:

vim /etc/snmp/snmpd.conf

Comment out 15th rows and uncomment 17th rows:

#agentAddress  udp:127.0.0.1:161agentAddress udp:161,udp6:[::1]:161

Comment out rows 51st and 53, and add a new configuration line, as shown below:

#rocommunity mypass  default    -V systemonly#rocommunity6 mypass  default   -V systemonlyrocommunity mypass

Save and exit.

Run the systemctl command to start the snmpd service:

systemctl start snmpd

On the shinken server, create a new file in the hosts folder to define a new host:

cd /etc/shinken/hosts/vim host-one.cfg

Paste the following configuration information:

define host{        use                 generic-host,linux-snmp,ssh        contact_groups      admins        host_name           host-one        address             192.168.1.121        _SNMPCOMMUNITY      mypass        # SNMP Pass Config on snmpd.conf    }

Save and exit.

Edit the SNMP configuration file on the shinken server.

vim /etc/shinken/resource.d/snmp.cfg

Change public to mypass-the password must be the same as the one you used in the snmpd configuration file on the client:

$SNMPCOMMUNITYREAD$=mypass

Save and exit.

Restart both the server and client:

reboot

Now the Linux host has been successfully added to the shinken server.

Step 5 Access Shinken Webui2

Access Shinken webui2 in Port 7677 (replace the IP address in the URL with your own IP address ):

Http: // 192.168.1.120: 7767

Log On with the administrator user and password (the one you set in the admin. cfg file)

Shinken panel in Webui2:

Our two servers are being monitored by Shinken:

List all services monitored by linux-snmp:

Status information of all hosts and services:

FAQ about Shinken in step 1NTP server problems

When you get the following NTP error message

TimeSync - CRITICAL ( NTP CRITICAL: No response from the NTP server)TimeSync - CRITICAL ( NTP CRITICAL: Offset unknown )

To solve this problem, install ntp on all Linux Hosts.

sudo apt-get install ntp ntpdate

Edit the ntp configuration file:

vim /etc/ntp.conf

Comment out all pools and replace it:

#pool 0.ubuntu.pool.ntp.org iburst#pool 1.ubuntu.pool.ntp.org iburst#pool 2.ubuntu.pool.ntp.org iburst#pool 3.ubuntu.pool.ntp.org iburstpool 0.id.pool.ntp.orgpool 1.asia.pool.ntp.orgpool 0.asia.pool.ntp.org

Then, add the following restriction rules to the new row:

# Local users may interrogate the ntp server more closely.restrict 127.0.0.1restrict 192.168.1.120 #shinken server IP addressrestrict ::1NOTE: 192.168.1.120 is the Shinken server IP address.

Save and exit.

Start ntp and check the Shinken panel.

ntpd
Check_netint.pl Not Found

Download the source code from the github repository to the shinken repository directory:

cd /var/lib/shinken/libexec/wget https://raw.githubusercontent.com/Sysnove/shinken-plugins/master/check_netint.plchmod +x check_netint.plchown shinken:shinken check_netint.pl
Network occupation Problems

This is the error message:

ERROR : Unknown interface eth/d+

Check your network interface and edit the linux-snmp template.

On my untu server, the NIC is "enp0s8" instead of "eth0", so I encountered this error.
Vim:

vim /etc/shinken/packs/linux-snmp/templates.cfg

Add Network Interface Information in Row 3:

NET_IFACES         eth/d+|em/d+|enp0s8

Save and exit.

From: https://linux.cn/article-7821-1.html

Address: http://www.linuxprobe.com/server-monitoring-system.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.