Monitoring Your Servers for Free (Part 2)

In Part 1 of our discussion, we covered how install Nagios Core 4 from source on Centos 7. Now that we have a Nagios server up and running, it’s time to begin monitoring things. To begin with, lets cover agent vs agentless Nagios monitoring. If you would like to perform simply checks such as determining if a switch or printer is responding to ping, you can setup basic ping monitoring without configuring an agent . As long as our Nagios server is able to reach the device and the device has ICMP enabled, everything will be happy. This type of monitoring can also be used to perform checks on website access, DNS resolving to expected locations, and SSL check (however that is not covered in this post). To monitor uptime, resource utilizaition (HDD space, CPU, Memory, etc), and specific services, we will need the Nagios agent. The agent is available in both Linux & Windows flavors. The Nagios agent for Linux is called NRPE and can be installed using apt-get or yum (ex; yum install nrpe). On the Windows side, the Nagios agent is NSClient++ and can be downloaded as an executable, see the download location:

Nagios Server Side Configuration

Nagios retrieves its monitoring configuration from the nagios.cfg file located in /usr/local/nagios/etc/nagios. The the nagios.cfg file contains definitions that point to templates that define what is being monitored. When creating new templates, it is important to remember to go back and add the nagios.cfg entry corresponding to the new template (or to uncomment one of the default templates if you choose to use one).

The other locations of interest we will take a look at are the templates located in /usr/local/nagios/etc/objects. If you choose to modify the existing templates rather than creating new ones, I would recommend making a backup copy of these templates to keep just in case you ever need to restore them or refer back to them (ex: cp windows.cfg windows.cfg.bak) One of the first templates we will want to modify is the contacts.cfg, this is where you can add the email address (or distribution list) that you want to receive nagios alerts. For example if I want to receive Nagios alerts at I can set this within the contacts.cfg. The final thing we need to discuss before we begin walking through some actual setups, is that Nagios communicates on port 5666, you will need to ensure that the server you are monitoring have the ability to communicate with your Nagios server on port 5666, and that port 5666 is open on your Nagios server (see example below):

iptables -A INPUT -p tcp -m tcp –dport 5666 -j ACCEPT

Fortunately the NSClient++ agent makes the needed provisions in the Windows firewall on install, however you will still want to be aware of this if hardware firewalls or AWS security rules are between your Nagios server and the infrastructure that it is monitoring.

Monitoring Printers

Let’s go ahead and setup some basic print monitoring now that we have an overview of the basics. For this example I am going to use the default network printer template provided by Nagios. In my examples I am using nano as the simple text editor, depending on your installation of Centos you may or may not have this editor by default, however you can use vi, vim, or any other Linux text editor, or install nano (yum install nano).

  1. cd /usr/local/nagios/etc/objects
  2. cp printer.cfg printer.cfg.bak
  3. nano printer.cfg
  4. At this point we can now create our host definitions, in the example below, you will see my entries for 2 printers. Customize your host definitions according to your environment, you can simply copy and paste to add more host definitions (customizing them with the appropriate info).     host def(click image to zoom)
  5. Customize the host group if desired, I have left this default since I am only manage the printers for one site
  6. In the service definitions section you will want to replace the dummy host_name with the hostnames defined in your host definitions. To list multiple, you can type them on the same line separated by commas (ex: host_name      IT_ColorLaser,Lobby_Copier). For my monitoring purpose I only care if the printers are on the network, so I am only monitoring ping. Any unused service definitions must be commented out or deleted.
  7. nano /usr/local/etc/nagios.cfg
  8. remove the # in front of cfg file path for the printers hostgroup (see example below)
    printercfg(click image to zoom)
  9. At this point we can save and exit nagios.cfg and restart nagios (systemctl restart nagios.service)
  10. If we’ve done everything right at this point the web page should now have an additional host group for network printers that are lit up green


Monitoring Windows Servers

Now that we’ve successfully gone through setting up printer monitoring, lets get started with Windows Server monitoring. For larger organizations, there will be large groups of servers configured with similar roles, features, and uses. If you’re IT environment is like most SMB shops, you may only have 1-2 Windows Servers configured the same way, and these are likely to be Domain Controllers. You may choose to setup all of your Windows Servers under a single Nagios template and associating host definitions only with the services you want monitored, or you may choose to create multiple templates based on function, so instead of everything being under windows-servers,  you may have windows-domaincontrollers, windows-webservers, etc. I have my production environment setup using the latter method, however for the sake of simplicity and minimizing config sprawl, we will add a couple of servers into monitoring. The servers I have chosen are a 2012 Domain controller, and a 2008 R2 server configured with IIS.

  1. Prepare your Windows servers by downloading and installing the NSClient++ available at
  2. Proceed through the wizard entering the IP address of your Nagios server, no password, and check the first 3 boxes see below:ns++wizard(click image to zoom)
  3. Now that the client is prepared, we can ssh into our Nagios server and complete the configuration on the Nagios side
  4. cd /usr/local/nagios/etc/objects
  5. cp windows.cfg windows.cfg.bak
  6. nano windows.cfg
  7. Edit the host configuration to contain the information for your servers. See the example screenshot below of the 2 servers configured for this demohost def(click image to zoom)
  8. add the hostnames defined in the host configuration to the service definitions (note: on services such as W3SVC that apply only to one server, be sure to only include the hostname of the server it is applicable to).
  9. To monitor additional services you will need to create service definitions for them. The easiest way is to copy an existing service definition and customize it with the service you wish to monitor. I have done this in our example by copying the W3SVC service and using it as a template for our DNS Server and AD services. To find service names on your windows server you will want to go to services.msc, locate the service, right click and make note of the service name and display name.custsvc(click image to zoom)
  10. In Server 2008 R2 and later ICMP ping is turned off by default. This will result in a false positive for host down when monitored by Nagios. To enable ICMP open cmd or Powershell and type the following and press enter: netsh firewall set icmp 8
  11. nano /usr/local/nagios/etc/nagios.cfg and uncomment out the cfg file path for windows.cfg
  12. systemctl restart nagios
  13. At this point if we are successful we should see a host group with each server and its services listed

Monitoring Linux Servers

To monitor a Linux server the process is somewhat simple. In the environment I support, our most common use case for Linux is as a web server for our web based SaaS application. Being that nearly every Linux server in our environment is configured the exact same way, the use of a single template with multiple hosts is extremely applicable. If you are installing on Centos you will need to enable the EPEL repo or obtain the NRPE plugin through wget. For more info about EPEL visit

  1. yum install nrpe
  2. nano /etc/nagios/nrpe.cfg
  3. Locate the allowed_hosts portion of the nrpe.cfg
  4. Add a comma after the localhost address, add a space then type the IP address of your Nagios server (ex: allowed_hosts=,
  5. save and exit
  6. chkconfig nrpe on
  7. Now that we’ve configured out client, lets hop back over to the Nagios server
  8. cd /usr/local/nagios/etc/objects
  9. cp localhost.cfg linux.cfg
  10. nano linux.cfg
  11. Replace localhost in the host definitions with the name and IP of the web server(s) you are monitoring
  12. Change the hostgroup name to something else (ex: linux-webservers) as well as the alias (ex: Linux Web Servers)
  13. Replace all instances of localhost in the service definitions with the hostname of your web server(s) as defined in the host definitions
  14. Save and exit
  15. nano /usr/local/nagios/etc/nagios.cfg
  16. Copy and paste the definition for localhost and modify the description and path to correspond to the linux.cfg object
  17. systemctl nagios restart

If all has gone well at this point we should see another host group containing our web server(s).


Printer Monitoring Video

Windows Server Monitoring


More coming soon!



Thanks for sticking with me, I know this has been a long post. Hopefully this will help you to get your own free alert monitoring going with Nagios in your environment.

Monitoring Your Servers For Free (Part 1)

We’ve all had the dreaded phone call “did you know XYZ server is down”? This is normally followed by a flood of calls and at some point questions regarding how to be more proactive in responding to issues. First and foremost, let me be clear no matter how good of an IT admin you are, there will always be some unexpected downtime (unless you work for the only SMB size company on the planet with clustered and redundant everything). That said careful planning and monitoring can help reduce downtime and help to provide a more proactive response to outages. There are untold amounts of monitoring solutions out there from Opsview, PRTG, Nagios XI, Solar Winds, etc. Each of these products is certainly a fine solution for monitoring, however monitoring gets expensive quickly. Perhaps you need to build a proof of concept or just need something simple and free. Enter Part 1 of Monitoring Your Servers For Free!


Nagios Core:

For alert monitoring with granular features such as monitoring specific services on your server infrastructure or simply running ping checks to make sure you wireless APs are alive and responsive, Nagios core is hard to beat. If you’re a Linux admin this should be a walk in the park for you, however even for a Windows admin this is a fairly easy setup with solid instructions and a few gotchas. The link below details the installation steps for both Debian and RHEL flavors of Linux, however some undocumented gotchas to be aware of (if you want to access the web page from something other than the local host you will need to create iptables firewall exceptions (as well as firewalld for RHEL 7). Below is an example of an iptables entry to allow inbound traffic on port 80, the same can be applied to 443 and any other needed ports.

iptables -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT

Installation Instructions:



Now that we’ve got a Nagios server up and running, we’ll start monitoring services on our infrastructure. Stick around for part 2 coming next week as we dive into service monitoring.

Offsite Backups for Home Use

One of the most frequent situations I run into when helping friends and family out with random computer issues (viruses, malware, computer won’t boot, dead hard drive, etc) is that almost nobody backs up their data. We live in a digital age where photos and family memories live on hard drives more often than they live in photo albums. Ask yourself, when was the last time you backed up photos from you vacations, photos of your children, or wedding photos? I know some folks are good about backing up weekly/monthly/quarterly to an external hard drive, however I’ve encountered situations in which the external backup drives have failed or have been dropped. The other potential issue of backing up to an external drive is that it often resides in the same house as the computer it’s backing up, meaning in the event of burglary or a fire, all would be lost. So by this point you’re probably asking yourself where I’m going with this, and rightly so, we’ll answer a couple of quick questions and jump right in.

What Constitutes an Offsite Backup?

Realistically, anything that gets your backups offsite, this can be as simple as backing up to an external hard drive, and backing that drive up to an additional external drive that you store in a safety deposit box or elsewhere. Additionally online backup services such as iDrive, Carbonite, or Amazon S3 are all reasonable solutions, however they take time to backup (2 of the 3 run on a schedule the other requires manual intervention) and unless you’re using a desktop most people will only crack open their laptop long enough to do what they want and put it back to sleep. The other option is the use a cloud based document storage solution.

What is the Cloud and Why Should I Backup There?

Loosely defined, the cloud is a software or service that is a web based solution, typically hosted in a large data center that meets major industry security standards, and more often than not is backed up redundantly to other data centers globally. Most of us carry multiple devices now, be it a smartphone, tablet, laptop, or desktop, I would venture to bet that you have at least 2 of the 3 if not all of the above. The four major cloud storage solutions we will discuss have apps for both desktop operating systems as well as common mobile operating systems. This allows you to access you data from any device seamlessly.

Which Cloud Storage Should I use and How Much Does it Cost?

While there are a multitude of cloud storage vendors out there, the most notable and commonly used 4 are Dropbox, Onedrive (formerly Microsoft Skydrive), Amazon Cloud Drive, and Google Drive. Fortunately in the arms race to attract more subscribers prices have continued to rapidly drop for cloud storage. While I will list prices below, the best bet is to check the vendor website before subscribing as prices will likely change. As to which vendor is the best choice, the answer is found in your current ecosystem and pricing needs.

Dropbox (

Dropbox is one of the most widely known names in cloud storage and has one of the larger subscriber bases. Dropbox is simple to install and use. To setup Dropbox simply go to and download Dropbox. After install, you will be prompted to sign in or create an account. Once your account is created a Dropbox folder will show up in your user folder as well as in your system tray (Windows) or titlebar (Mac). Using Dropbox is quite simple, the tutorial during install walks you through the basics of dragging and dropping your files into your Dropbox folder. If you have a smartphone, you are able to go to the app store to download the Dropbox app, which will allow you to view your Dropbox files on your mobile device, as well as the ability to turn on automatic photo upload (automatically uploads any new pictures you take with your phone/tablet to Dropbox)

Costs: 2GB free storage, 1TB=$9.99/month

OneDrive (

At the launch of Windows 8, Microsoft made the jump into the cloud storage business with SkyDrive. After some trademark issues with the name, Microsoft has rebranded the service to OneDrive. If you are currently running Windows 8 or 8.1 and have signed up for a Microsoft account, you will notice that OneDrive is already installed on your machine. Additionally if you opted to sign up for Office 365 (subscription based Microsoft Office), you are given 1TB of Onedrive space for free already. Additionally, Office 2013 allows you to save directly to OneDrive. If you are in this boat, this is probably your best value. Using OneDrive is simple, all you need to do is open windows explorer (click the folder icon on your taskbar) and click OneDrive on the left hand side of the window. Within OneDrive you can create folders, and simply drag and drop your documents, pictures, music, movies, etc and they will sync with OneDrive. Additionally if you have a smartphone or tablet with the OneDrive app installed, you are able to turn on automatic camera upload, which will automatically sync any pictures you take to OneDrive.

Costs: 15GB free storage, 100GB=$1.99/month, 200GB=$3.99/month, 1TB=$6.99/month (or free with Office 365)

Amazon Cloud Drive (

Anyone with a computer and internet connection surely knows who web retailer giant Amazon is. Among the many other entrants into the cloud storage space, Amazon has jumped into the game as well. Amazon features a similar feature set and use case to Dropbox and OneDrive, however it does slightly differ in the area of cost. If you have an active Amazon Prime membership, you are entitled to unlimited photo backups based on Amazon’s current offerings. Much like the other two services, backing up is as simple as drag and drop into the Amazon Cloud Drive folder, and mobile apps are available on all major smartphone platforms. If you are storing small amounts of data or just simply looking to backup pictures, Amazon may be one of the more affordable options, however the pricing quickly shoots up to more than double what competitors are charging as you begin to near the 1TB level of storage.

Costs: 5GB free storage, 20GB=$10/year, $50GB=$25/year,1000GB=$500/year

Google Drive (

If you’ve been on the web much over the past decade, you’ve realized there isn’t much on the web Google isn’t involved with. In an effort to help facilitate collaboration for small startups and to grant easy data sharing and backup for Universities and users alike, Google jumped into the cloud storage market as well. If you are a currently a Gmail or Google Docs user, you may find Google drive to be an appealing options as it seamlessly integrates with other Google services. The desktop and mobile clients function nearly identically to their competitors. Like many other Google services, Google drive is dead simple to use and works reliably without any notable issues or hiccups.

Costs: 15GB free storage, 100GB=$1.99/month, 1TB=$9.99 per month

The Bottom Line

The most expensive solution of all is choosing not to back up or not to back up effectively and redundantly. With so much of our digital lives at stake on a single point of failure, it just doesn’t add up to choose to go on without backups. I can promise you as an IT professional even the best kept systems will fail, even the best hard drives will fail, and the cost of professional data recovery starts at a minimum of $300-$500 and does not guarantee that all of your files will be recovered. At the end of the day, any of the four solutions provided above will offer adequate redundant offsite data backups, giving you piece of mind that your precious digital memories are safe and that you’ve done your part to protect yourself. There are other additional cloud services I did not mention in this post for sake of keeping this post from being any more excessively longer than it already is. Thanks for sticking with me, go get yourself a cup of coffee and start backing up! See you all in the New Year!!!