loading

Install and setup the latest version of shinken Network Monitor for a home or small business.

At work, my team develops the software for more than 75 server classes, with over 300 instances in multiple data centers and points of presence. There is an experienced operational team that monitors and keeps these servers running 24x7. I don't have anything close to their knowledge or expertise. Besides myself, I have no one supporting my home network. And, I want to spend zero time monitoring and maintaining my home network.

My home LAN has more than 40 connected devices, which is much bigger than I ever expected. Many homes, perhaps even yours, have a large number of connected devices. Examples of networked devices are:

  • laptops and tablets
  • eBook readers
  • cell phones
  • nest thermostats, ring doorbells
  • security system, irrigation system
  • smart TVs, U-verse receivers and DVR
  • streaming media servers (Apple TV, Roku, ChromeCast FireStick)
  • raspberry pi home automation projects

As more home devices become connected, I expect my network to grow.

Why should a home have a network monitor? There are critical servers and services on a home network. Examples of critical servers include: ISP gateway, wireless access point, security system, and irrigation system. Examples of critical services include: backing up PCs or MACs, ensuring Wi-Fi or internet is operating at required speed. To ensure critical services/servers are running, they should be manually checked at regular intervals, which requires a lot of time. Alternatively, the servers should be automatically checked using a network monitor, which attempts to correct the issue and sends an alert if it is unable to correct.

Shinken is a Network Monitor that runs on any computer. In this instructable, I will get it to run a Raspberry Pi (2 or 3) running Diet-Pi or raspbian.

Many excellent network monitoring applications exist. Examples are: SolarWinds, NetCool, and nagios. These applications are capable of monitoring, identifying issues, self-correcting and sending alerts.

In general, I have been trying to keep my network low-cost and simple to maintain and update. I have narrowed my focus to open source applications written in a small number of languages. My languages of choice are: python, bash, html and css.

Shinken is an open source rewrite of nagios in python. So, shinken fits within my limitations and meets my needs.

The instructable provides step-by-step instructions if you want to do it by hand. But, I want a repeatable process, so I also include an unattended install script in the appendix, which does everything with a couple of commands.If something goes wrong, just run the unattended install and it should fix most issues.

Step 1: Gather Parts

Overtime, I have found the parts below perform best in my applications. These parts are more expensive than those contained in the usual starter kit.

Get parts and tools (prices in USD):

    • Raspberry Pi 2 model B (Pi 3) Element14 $35 ($39)
    • Panda 300n WiFi Adapter Amazon $16.99 (not needed if Pi 3 is used)
    • 5.2V 2.1A USB Power Adapter from Amazon $5.99
    • Micro USB to USB cable 3ft from Amazon $4.69
    • CAT5e/6 Ethernet cable $x.xx, depends on the length
    • Case from Amazon $6.99
    • SanDisk Ultra 16 GB microSDHC Class 10 with Adapter (SDSQUAN-016G-G4A) from Amazon $8.99
    • Common or reusable items:
      • MacBook Pro (I use a MAC because it runs linux as its base OS. However, a Windows PC can be used)
      • FTDI TTL-232R-RPI Serial to USB cable from Mouser $15
      • TV with HDMI port
      • USB keyboard
      • USB mouse
      • HDMI Cable (only needed on first pass)

    Notes:

    • Text enclosed in spades, such as, ♣replace-this♣, should be replaced with an actual value. Of course, remove the spades.
    • Commands are indicated by a $. If cut-and-pasting commands, do not copy the $.

    Step 2: Setup Raspberry Pi

    Use this instructable to setup the Raspberry Pi running DietPi. If you prefer, Raspbian can be used with this instructable.

    I changed the hostname to ♣monitor-hostname♣. Replace items in ♣'s with actual values.

    Step 3: Open Terminal Window and Login

    Before each of the following steps:

    • Open a terminal window on a MacBook or PC, and then
    • Login into Raspberry Pi
    $ ssh pi@♣raspberry-pi-ip-address♣
    

    If you installed avahi-daemon on your Raspberry Pi, then you can login this way (I am lazy and I don't want to remember IP addresses):

    $ ssh pi♣hostname♣.local

    Step 4: Always Upgrade and Update

    Before installing new packages on a server, always update and upgrade.

    • Update downloads latest package lists from appropriate repositories.
    • Upgrade updates the packages
    • Autoremove deletes packages that are no longer needed
    • Reboot is optional. Some services need to be restarted after an upgrade. Rebooting is the lazy way of ensuring all required services are properly restarted
    $ sudo apt-get update -y
    $ sudo apt-get upgrade -y
    $ sudo apt-get autoremove
    $ sudo reboot
    

    Or you can skip all the remaining steps and use the unattended install in one of the appendices.

    Step 5: Install Shinken Dependencies

    Often shinken runs on a very large server and is installed on a virtual machine (VMs). A large server is capable of running multiple VMs. VMs have many benefits when administering multiple servers, or multiple instances of the same server. VMs make efficient use of expensive server resources.

    A virtual machine can run on Raspberry Pi. However, many of the advantages of running a VM on a $35 Raspberry Pi are lost. Shinken does NOT require a VM. This instructable doesn't use a virtual machine.

    Install shinken dependencies: sqlite3, php5, python3, and some python libraries:

    $ sudo apt-get install sqlite3 -y
    $ sudo apt-get install php5 -y
    $ sudo apt-get install python3 -y
    $ sudo apt-get install python-pip python-pycurl python-cherrypy3 python-setuptools -y

    Step 6: Install Shinken

    Add shinken user and install shaken using pip.

    $ sudo adduser shinken 
    $ sudo pip install shinken 
    $ sudo adduser shinken sudo
    

    The above installs shinken and some daemons in /etc/init.d:

    • shinken-poller
    • shinken-reactionner
    • shinken-receiver
    • shinken-scheduler
    • shinken-broker

    Step 7: Initialize and Start Shinken

    Just in case shinken is running, stop it. Also, create a log directory and set the permissions.

    $ sudo mkdir /var/log/shinken
    $ sudo chmod 777 /var/log/shinken 
    $ sudo service shinken stop
    

    Run the following to initialize and start shinken:

    $ sudo shinken --init
    $ sudo /etc/init.d/shinken start

    Verify shinken is configured properly:

    $ /usr/bin/shinken-arbiter -v -c /etc/shinken/shinken.cfg

    Make shinken start on boot

    $ sudo update-rc.d shinken defaults

    Step 8: Setup and Configure Sqlite3

    Setup sqlite to be the shinken database:
    $ sudo shinken install sqlitedb

    Create a configuration file to add sqlite:

    $ sudo nano /etc/shinken/modules/sqlitedb.cfg
    

    I am using sqlite3. It is unclear how this maps into sqlite3 or into a particular sqlite DB file.

    define module {
        module_name     sqlitedb
        module_type     sqlitedb
        uri             /var/lib/shinken/webui.db
    }
    

    Change permissions on the file

    $ sudo chmod 777 /etc/shinken/modules/sqlitedb.cfg

    Step 9: Install Shinken Web UI

    Install Shinken's Web UI:

    $ sudo /usr/bin/shinken search webui 
    $ sudo /usr/bin/shinken install webui
    Grabbing : webui
    OK webui

    Edit Web UI configuration and change the entry: CHANGE_ME. I am not sure what it is supposed to be change to. I changed to a random word.

    $ sudo nano /etc/shinken/modules/webui.cfg

    Edit the master broker to include the Web UI modules

    $ sudo nano /etc/shinken/brokers/broker-master.cfg

    Change the line:

    modules 

    to

    modules webui

    Restart shinken

    $ sudo /etc/init.d/shinken restart

    Step 10: Add Users and Passwords

    Ensure there is method installed to authorize shinken users

    $ sudo shinken install auth-cfg-password
    Edit shinken's Web UI configuration:
    $ sudo nano /etc/shinken/modules/webui.cfg

    Change to look like:

    modules             auth-cfg-password

    Vince35 suggests a restart is needed at this point:

    $ sudo /etc/init.d/shinken restart

    Open a browser window and login using password and username: admin, admin. Enter the following in the browser's URL (remove the spaces around the colon):

    http : //♣hostname♣.local:7767

    login using admin, raspberry-pi-password

    And it should work!

    Step 12: Appendix: Updates

    15OCT2016: Updated cover image to include Shinken and Raspberry Pi logos

    16OCT2016: Rephrased some passages. No technical changes.

    19OCT2016: Updated instructable and UAI to start shinken on reboot

    Future Enhancements:

    • Add systems to be monitored, either in the instructable or as an appendix with example scripts

    Step 13: Appendix: Troubleshooting

    Change permissions on Directories

    /usr/bin
    /etc/init.d
    /etc/shinken
    /var/lib/shinken/modules/webui/
    /etc/shinken/modules/

    I restarted the Raspberry Pi, but shinken wouldn't start. I couldn't write to the log directories. So, I made the following changes:

    sudo mkdir /var/log/shinken
    sudo chmod 777 /var/log/shinken

    shinken localhost down

    If localhost shows as down.

    $ sudo nano /etc/network/interfaces

    For whatever reason, my /etc/network/interfaces file is usually messed up. Change this one line:

    auto lo iface lo inet loopback

    to these two lines:

    auto lo 
    iface lo inet loopback

    And reboot

    $ sudo reboot

    The init.d should start shinken automatically, but I had to do this:

    $ sudo /etc/init.d/shinken restart

    Step 14: Appendix: Unattended Install

    Make shinken installation and configuration very easy by automating the instructable steps using a bash unattended install script. The script assumes a raspberry pi running raspbian or dietpi, which was setup using one of the embedded links.

    I finished the script on github and

    • tested the source on dietpi
    • tested unattended install script on dietpi
      • ran one time
      • ran multiple times, with CTRL-c interrupts
    • tested unattended install script on raspbian and diet-pi

    The script assumes the username = pi, and the password = raspberry, and the script is trying to install shinken. If these aren't correct, then edit the file accordingly.

    Open terminal window on a MacBook or PC and run the following commands:

    $ ssh pi@♣ip-address♣
    $ sudo wget "https://raw.githubusercontent.com/dumbo25/uai_install_shinken_rpi/master/shinken_uai.sh
    $ sudo chmod o+x shinken_uai.sh
    $ sudo bash shinken_uai.sh
    $ sudo reboot
    
    $ sudo /etc/init.d/shinken restart

    The script takes a few minutes to run on diet-pi.

    Be sure to reboot the Raspberry Pi and wait until shinken starts

    Open a browser and in the URL window enter:

    <a>http://♣ip-address♣:7767</a>

    Login in using admin and ♣raspberry-pi-password♣

    And it should work!

    <p>hi i have done all the step mention above<br>but after i login into webui it shows that<br>localhost is DOWN, and description is &quot;[Errno 2] No such file or directory&quot;<br>i have no idea how to solve it</p>
    <p>#1 Did you try:</p><p style="margin-left: 20.0px;">sudo nano /etc/network/interfaces</p><p>and does it look like this (its all on one line):</p><p style="margin-left: 20.0px;">auto lo iface lo inet loopback</p><p>but it should look like this:</p><p style="margin-left: 20.0px;">auto lo </p><p style="margin-left: 20.0px;">iface lo inet loopback</p><p>save and reboot. Open a browser on a PC/MacBook and enter </p><p>http://&clubs;ip-address&clubs;:7767</p><p>#2 run the unattended install script, it can find or fix most issues</p>
    <p>I made until the step that I see a login page in front of me. But whatever credentials I try nothing works.</p><p>I<br> remember I needed to provide a login/pass during installation but left <br>the login blank (so it should default to....admin?) and a selfmade <br>password.</p><p>But also not working to login</p><p>Any ideas?<br></p>
    <p>Already found. After Step 10 and before opening the login page you need to restart shinken first!<br>I suggest to change that in your guide :)</p>
    <p>I added the step you suggested. Thank You.</p>
    <p>Whats is the URL to connect to shinken localhost? I am stuck on step 10.</p><p>Thanks</p>
    <p>1. Hostname</p><p>When you set up the raspberry pi, you should have set the hostname. To see the hostname type:</p><p>$ cat /etc/hostname <br>shinken</p><p>which, assumes you set the hostname to shinken.</p><p>If you want to change hostname, use:</p><p>$ sudo nano /etc/hostname</p><p>and change to whatever you want. To save and exit nano editor, use CTRL-o, ENTER, CTRL-x</p><p>2. Also, when you setup raspberry pi, you should have setup avahi. Avahi allows you to access by name rather than IP (my shinken IP is 192.168.1.100, yours may be different)</p><p>$ sudo apt-get install avahi-daemon</p><p>$ sudo nano /etc/hosts</p><p>192.168.1.100 shinken</p><p>To save and exit, use CTRL-o, ENTER, CTRL-x</p><p>$ sudo /etc/init.d/hostname.sh </p><p>$ sudo reboot</p><p>3. Make sure gateway is setup correctly on raspberry pi</p><p>$ sudo route -n </p><p>If your ISP gateway doesn't show with correct address, mine is 192.168.1.254</p><p>$ sudo route add default gw 192.168.1.254</p><p>4. Accessing</p><p>If you have already done everything above, then open a browser on laptop or PC and enter the following and remove spaces around the colon, :</p><p>http : //shinken.local:7767</p><p>If you don't want to use avahi, then just use the IP address of your shinken device (mine is 192.168.1.100) and remove spaces around colon:</p><p>http : //192.168.1.100:7767</p>

    About This Instructable

    5,535views

    27favorites

    License:

    More by jeff.cartwright.562:Multicast TV Using Raspberry Pi 3 & WinTV-HVR-955Q Setup Raspberry Pi 3 (for OTA TV Tuner) DIY project to build a Wi-Fi controlled extension cord 
    Add instructable to: