Advertisements

NagiosPi – Server Monitoring With The Power of Pi

NagiosPi is a lightweight, feature rich & fully configured Server Monitoring Distro for the Raspberry Pi. The Image contains Nagios Core, The Nconf front-end to easily edit hosts and configurations, Nagvis to translate your network health into an easy to read visual heads-up display & finally RaspControl to keep a close eye on Raspberry Pi Stats! While I have yet to test out the performance of NagiosPi in larger environments… I’m really optimistic about the general performance of the Image, as website response times are every-bit as fast as the Last Nagios Image I’ve done.  In fact, since we are using Nconf and Make-livestatus to interact with Nagios – Response times have been fantastic. If you wish to contribute (ideas or time) to the image, Please leave me a comment below or feel free to E-mail me directly via my Contact page. ~Enjoy.

 

Download NagiosPi:

You can download v2.2 of NagiosPi  HERE.

 

Installing NagiosPi:

  1. Download Win32DiskImager
  2. Write image to SD Card. (4gb+)
  3. After initial Boot-up, Run “Sudo raspi-config” to expand the file system.

 

About The Image:

  • SSH = pi/raspberry
  • Overclocked to “Medium” Setting
  • NagiosPi Landing Page:  http://Rasp_Ipaddres

This slideshow requires JavaScript.


 

For anyone interested in the details of my build, I’ve documented my entire process step-by-step…

[learn_more caption=”Getting Ready…”]

1.) Burn the latest image of Raspbian Wheezy to your SD card.

2.) Expand your File-system and customize.

 

3.) Let’s get up to date.

 

[/learn_more][learn_more caption=”Installing PHPmyadmin”]

 

1.) Install the MySQL DB

password: nagiosadmin

 

2.) Install phpmyadmin.

Choose apache when prompted.

When you are prompted again to configure DB via dbconfig – select yes.
password: nagiosadmin

 

4.) Next we need to alter the Apache configuration to include PHPmyadmin.

Scroll to very bottom of the file and add the following line:

Include /etc/phpmyadmin/apache.conf

Save the file. ( Ctrl + X  > Then Y to confirm )

 

5.) Now just restart the pache service:

 

6.) Now you should be able to access your MySQL database by accessing:

http://NagiosPi/phpmyadmin

User: root
Pass: nagiosadmin

[/learn_more][learn_more caption=”Installing Nagios3″]

 

1.) Install Nagios3

password: nagiosadmin

2.) Install NRPE plugin (optional)

 

[/learn_more][learn_more caption=”Installing Nconf”]

 

1.) Download & Extract Nconf  v1.3.0

While we’re at it, Lets give apache permission to the /var/www/nconf directory:

 

2.) Before we begin installing Nconf, We’ll need to go login to PHPmyadmin and create the required Nconf database and user:

  • Browse to: http://NagiosPi/phpmyadmin
    User: root
    Pass: nagiosadmin
  • Privileges > Add a new user
    User name:  nconf
    Host:             localhost
    Password:    nagiosadmin
  • Check the radio button to “Create database with same name”
  • Finally, Set the User permissions as shown in the screenshot below.
  • Click: Go to finish.

PHPmyadmin_Create_UserDB

Then Browse to  http://NagiosPi/nconf

 

3.) Most of this install is going to be just clicking the next button. However you will need to make one important change on Step 2 of the install process. This change has been highlighted in the screenshot below.

Nconf_WebInstall_Steps

 

4.) After Nconf installs, You will be prompted to delete the Update & Install files:

 

5.) Now we need to tell Nagios to use Nconf config files.

We will want to comment out any lines that begin with cfg_dir or cfg_file.

Then add the 2 following lines:

Nconf_Edit_nagios_cfg

Exit & Save.

 

6.)  Create the needed folders for our Nagios config files and set the appropriate permissions:

 

7.) Now we need to configure our deployment.ini file.

Un-comment and edit the following 3 sections where highlighted.

Nconf_Deployment_ini

Save & Exit.

 

8.) In order for our Apache web user to issue the Nagios reload command using sudo, We’ll need to edit the sudoers file and give www-data rights.

Then we add the following line to the end of the file:

# Allow www-data (apache) user to reload nagios
www-data ALL=NOPASSWD: /etc/init.d/nagios3 reload

Save & Exit. Then Reboot.

 

9.) Finally, After the reboot. We can test our Nconf install.

  • Browse to:  http://NagiosPi/Nconf
  • Make any quick change to the config ( add a host, service, edit a setting )
  • Click:  “Generate Nagios Config”
  • If there are no errors, You will have the option to Deploy the new Nagios Config.

 

Reference:

[/learn_more][learn_more caption=”Installing Mk-LiveStatus & Nagvis”]

 

1.) Install Mk-LiveStatus & Nagvis Requirements

 

2.) Set the appropriate permissions for use later.

 

3.) Configure Nagios to use MK Livestatus.

Add the following to the end of the file:

 

4.) After Nagios is restarted, the socket should be in place:

Restart Nagios:

To verify:

You should see a file called Live.sock.

 

5.) This will be our last step before we start installing Nagvis. Here we want to set the proper permissions for Nagvis to be able to access our Live.sock file we created earlier.

 

6.) Download & Extract Nagvis:

 

7.) Then to Start the Install:

I’ve included a screenshot of my responses to the install script to make this section easier to follow. Here are the 4 major prompts you will want to keep an eye on….

  1. Nagios Base Path: /etc/nagios3
  2. Nagvis Base Path: /etc/nagvis
  3. Use Make-LiveStatus:  Yes
  4. Make-LiveStatus Socket:  Unix:/var/lib/nagios3/rw/live.sock

Nagvis_Config

 

8.) After the install is complete, You will need to reboot Apache:

 

9.) Finally, run the following commands to fix nagvis permissions.

 

 

10.) When you are done, you should be able to access Nagvis.

http://NagiosPi/nagvis

User: admin
Pass: admin

 

Reference:

[/learn_more][learn_more caption=”Installing RaspControl”]

 

**Nothing special Here, Great directions for installing RaspControl are on their GitHub Page.

[/learn_more]

Image Change Log:

NagiosPi – v1.0

  • Installed & Configured Nagios, Nconf & Nagvis
  • Created NagiosPi Landing Page
  • Set hostname to “NagiosPi”
  • Installed PHPmyadmin
  • Installed RaspControl

NagiosPi – v1.1

  • Fix RaspControl Logo on Landing Page
  • Setup/Configure Postfix
  • Fixed notify-by-mail command paths

NagiosPi – v2.0

  • Misc. configuration & permission fixes

NagiosPi – v2.1

  • Misc. configuration & permission fixes

NagiosPi – v2.2

  • Fixed permission issues with Nagvis
  • Updated image to be compatible with latest models of the Raspberry Pi
  • Reduced image size

 

Additional Information:

 

Configuring E-mail Notifications(internal)

**Please note that you will have to make these changes manually as described below until v1.1 is released!

 

1.) Install PostFix:

NagiosPi_PostFix_Setup_ScreenShots

 

2.) Now we should be able to send a test e-mail internally.

 

If you are getting IPv6 disabled messages every time you try to send a test email, You can
force postfix to use ipv4 to avoid getting these spammy messages.

 

#Add this Line to EOF
inet_protocols = ipv4

 

3.) At this point you should be able to successfully send e-mail via postfix. Next we will want to make sure that Nagios can send successful notifications as well. The first thing we will need to do, Is fix the mail path command used by Nconf.

  • Misc Commands > modify hosts-via-email > Edit

Change the listed command to:

**The important change here is that we change the “/bin/mail” path to “/usr/bin/mail“.

 

4.) That really should be all it takes. I would go ahead and  setup a test host within Nconf and deploy it to Nagios to make sure that E-mail Notifications are indeed working properly. By default there is a example alert for linksys-srw224p which should throw a failure alert every 1/2 hour as well. It’s probably a good idea to go ahead and remove this alert once you’ve figured out that E-mail notifications are indeed working 😀

 

**Check out the next section to easily setup SMS notifications.

Configuring SMS Notifications

Each major cell phone carrier is able to translate an e-mail to an SMS message when given the proper format from a trusted source. Now all we need to do is create an external user in Active Directory for each person that needs to be notified via SMS, using the following E-mail formats.

  • Verizon:             1112223333@vtext.com
  • AT&T:                  1112223333@txt.att.net
  • US Cellular:       1112223333@email.uscc.net
  • Sprint:                 1112223333@messaging.sprintpcs.com

External_Email_User

You then add each team member to a Distribution group – and Setup Alerts to be sent to that distribution group, just as you would send out an e-mail Alert.

Improving Performance

Here are few ways you can try to improve the performance of your NagiosPi image…

1.) OverClock

Overclocking within sudo raspi-config is directly supported by the Raspberry Pi foundation, however you should be warned that pushing your overclocking settings too far may result in corruption of your SD card image. Always create a backup of your SD card image if you decide to try any setting above “meduim”.

 

2.) Change mem-split

Basically what we are doing by setting memsplit to a value of 16, is telling the raspberry Pi that we are operating a headless unit here. ( no monitor ) And it should be allocating as little ram as possible to our Pis graphics.

 

3.) Get a approved Class 10 SD card. You can find the approved list of SD cards @ http://elinux.org/RPi_SD_cards

 

4.) Un-install any additional software. If you simply aren’t using PHPmyadmin, RaspControl or Nagvis – You can remove them to reduce some of the CPU load on your Raspberry Pi unit.

 

 

Advertisements

106 Comments

  1. Александр Беккер
      • Александр Беккер
          • Александр Беккер
              • Александр Беккер
              • Александр Беккер
              • Александр Беккер
              • Александр Беккер
  2. Malcolm
      • Malcolm
          • Peter
            • Malcolm
              • Yanig
  3. jon
  4. Mono
  5. Andy
    • Arshad
  6. RictusGrin
  7. PietjeNL
  8. Mike D
    • asdf
  9. Jamie McCallum
        • Jamie McCallum
            • JasonP
              • André Cardoso
        • Jamie McCallum
        • Jamie McCallum
          • Jamie McCallum
              • Jamie McCallum
              • Jamie McCallum
      • Jamie McCallum
  10. eStark
    • eStark
        • Lupita Uscanga
  11. paulwebster
  12. Gino
    • Gino
      • ELWIS
  13. Jan Pollet
  14. Rodrigo Araújo Cavalcante
  15. Ray Prettyman
    • rg33
  16. Jeremy
          • Jérémy
  17. K_i_l_g_o_r_e_T_r_o_u_t
  18. JasonP
  19. Adesfire
  20. Luke Frost
  21. Parkan
    • Parkan
  22. Thomas Zimmermann
  23. André Cardoso
  24. André Cardoso
  25. Michael
  26. shonyx
  27. Martin
  28. Ben Hall
  29. David Bailey
  30. Stephan P.
  31. dickinsonjl
  32. Wafi
      • Wafi
      • Timothy Seibert
      • Timothy Seibert
          • Timothy Seibert
  33. Maurice S