Friday, August 21, 2015

The Wonders of Puppet

So one of the biggest things that many a sys admin has issues with is system configuration, replicability, being able to quickly deploy and provision new systems, verifying that all the correct software is installed on existing systems, etc...  The answer to this is age old, and has been seen in many projects such as CFEngine, Chef, Ansible, and Puppet.

Today I am not going to go into detail on comparing the different projects.  Today I just want to talk about configuration management, and puppet's place within this realm.

Puppet will easily allow the configuration and deployment of a server, and will allow periodic checks to make sure that all software, configuration settings, security settings, etc... are installed/configured on a server.

The language of puppet is not too complex, but a basic understanding of programming will definitely help.  This programming background is not required at all, but is slightly helpful for learning how to write in puppet.

To use puppet, a basic understanding of Linux will be needed as the puppet master runs on Linux, but puppet agents can be ran on any Operating System.  I personally would recommend using either SUSE or CentOS for the puppet master.  I will go over installing the puppet master on both SUSE and CentOS servers in a future post.

If you are curious how to install the puppet master on CentOS (or any RHEL derivative for that matter), you can look at the official documentation from puppetlabs here.

Once the puppet master is installed, you can install the puppet agent on your nodes of choice.  You can see how to do this from the official puppet documentation:

Red Hat
Debian/Ubuntu
Fedora
OS X
Windows Server
Tarball Install for any *Nix system

The short and long of all of this is that if you are only managing a couple of servers, puppet might be too much overhead for your environment.  But, once you start getting into a complex enterprise environment, puppet can save you time, effort, headache, and many problems.  By installing and configuring a puppet environment you can guarantee your system configuration and security.

Wednesday, August 5, 2015

Nagios: What is it? Why should I use it?

So, this will be the first in a longer series of Nagios related posts.

Nagios, quite simply, is a IT monitoring software application.

What does this mean?  Nagios is a network monitoring tool that can provide you with health status, uptime, availability, and a myriad of other information about all your systems, in one convenient platform.  it gives a quick and concise overview of all your systems, and proactively monitors them for up/down status, and whatever other checks you choose to configure it to do.  Here are a couple of screenshots of an environment I set up to monitor 2 Linux Servers, the NagiosAdmin Box, and 15 Windows servers.


























And for a list of services being monitored:












































You can have it just display this information on a webpage, or you can also have it send out alerts also so that even if you are away from your desk, you can know if issues arise.

From the pictures above, we can see that I don't have my entire monitoring zone configured correctly.  We can see on the Windows machines, that while IIS is being monitored correctly, most of the machines are not reporting the CPU status.  This is due to configuration that hasn't been done at this point, so I could show an example of some things working, while others not.

We can also see on my Linux boxes, that we are running JBoss.  JBoss is actively being monitored, and if it were to hang, I would get an email and a text message informing me of an issue with JBoss.  It can also be noted that the Disk Space is being checked on my Linux boxes.  linux1 is ok, the root partition is only 82% full, but I configured Nagios to send me a warning at 85% full, and to tell me it is critical at 90% full.  So 82% is ok.  linux2 however has an issue.  The root partition is 87% full, which exceeds the configuration of 85%, so it is set in a warning status.  Normally this would inform me every 30 minutes of this, but sense for something like this I do not want to be constantly bugged about, I have disabled to warnings just on the Disk Space Check service.

At first glance, Nagios may not seem like the prettiest product out there, and I'll be honest, I've seen things that look a lot better.  That being said, there are a lot of after-market solutions which can come into play which can help improve the look and feel of the end-user experience, but we won't go into those at this point.

So up to now, we've talked a little about what Nagios is, next we will talk about why to use Nagios.

While there are many different applications out there that can do the same/similar job as Nagios, there are five main reasons why I like it:
  1. Nagios Core is FREE

  2. Nagios, while they have a paid version, which has support from the vendor, some additional bells and whistles, offers a free version of their software.  This allows small and medium (and even larger if they wish to invest the time and expertise) businesses to have an industry standard network, application, server, etc... monitoring application without having to fork out tons of money to do so.

  3. Nagios Monitoring is System Agnostic

  4. Nagios, while designed to run on Linux for the monitoring server, can monitor any type of operating system whether it be Windows, Linux, or OS X.  This allows an admin the flexibility to have a one stop shop for monitoring and taking care of his systems.

  5. Nagios is Proactive

  6. What do I mean by "Nagios is Proactive"?  What I mean is that once you have set up and configured Nagios, it will contact you however you have configured it (for myself, I have done both email and text message) to let you know if there is a problem with a service you are monitoring, and which server is affected.  If the server comes back up, whether naturally or through the work of another admin, it will notify you of that also.  This allows a SysAdmin to go about his other work without having to constantly check application and server status to make sure that things are happy.  I don't know about others, but that is a huge stress relief and time free up for me.





  7. Nagios can Leverage the Systems Being Monitored

  8. Via plugins, like NRPE, you can monitor system resources that would normally not be available through a network monitoring scan.  What I mean by this is you can monitor client
    • CPU Usage
    • Memory Usage
    • Disk Space
    • Applications and Processes
    • Anything else you can imagine that you can code/script up





  9. Nagios is Modular

  10. The problem that a lot of people have with Linux and Open Source projects is that they can quickly get very confusing and a lot of applications have a one-stop configuration file, that can easily become a multi-thousand line file that is a bear to manage.  The Nagios project has done away with a single configuration file, and have modularized the systems to allow for multiple configuration files.

    Let's set up the following scenario to see how this is helpful.

    Image you are a Systems Administrator, and monitor 100 servers.  You have 20 Linux boxes and 80 Windows Boxes that you take care of.  These servers support 10 different applications with 2 Linux and 8 Windows boxes for each application.  If you were to try and put all 100 servers in one configuration file, and having 10 lines per server declaration (more details on how this is done will be had in a future post), that would quickly give you a 1000 line file to deal with, and managing all your hosts would be difficult.  Plus, that's only the server declarations, this doesn't include any monitoring definitions that could easily start spanning many thousand more lines of configuration.

    Instead, Nagios allows the Admin to use the /etc/nagios/nagios.cfg file to specify where other specific config file/config directories are.  This can allow us to create a file structure path that makes it easy to administer.  We can house our server declarations in multiple files as so:
    • /etc/nagios/server/group1.cfg
    • /etc/nagios/server/group2.cfg
    • /etc/nagios/server/group3.cfg
    • etc...
    And then we can host our configs also in the same way:
    • /etc/nagios/config/group1/linux.cfg
    • /etc/nagios/config/group1/windows.cfg
    • /etc/nagios/config/group2/linux.cfg
    • /etc/nagios/config/group2/windows.cfg
    • /etc/nagios/config/group3/linux.cfg
    • /etc/nagios/config/group3/windows.cfg
    • etc...
    As we can see, if we need to change something with the declaration of a server in group 1, it is easy to find the file associated with the server group, and if we then need to add a monitoring definition to group 2 Linux servers, we can very quickly go in edit the configuration for that group, without running the risk of affecting another group.
So to sum things up, Nagios is a network application monitoring utility that can proactively monitor your network.  While there are paid versions of Nagios, it is free to use and can be configured to monitor just about anything you want.

While there are other utilities out there which perform a similar function as Nagios, and many of them work splendidly, I have decided to focus on Nagios for the time being as it is free to use for any individual or business, supports cross-platform monitoring, and is modular in its approach for configuration.

A CentOS Basic Install

Today we're going to talk about the basic install of CentOS 7.

When it comes to enterprise operating systems where you are not paying a company for support, there's nothing quite like CentOS. The Community ENTerprise Operating System does a phenomenal job of following the Red Hat cycle and providing an Enterprise class OS without having to fork out a lot of money for it. It is perfect for small and medium businesses, or for a great platform to start learning on.

So here we go with our install.


  1. First things first, we need to download the CentOS iso.  The one to pick comes from personal choice, but if unsure, download the dvd iso.
    1. If you are installing to a phsyical machine, you will need to burn this iso to a dvd, or make a bootable usb out of it.
    2. If you are installing to a virutal machine (i.e. vmware, virtualbox, or some other virtualization software) then you can boot directly form the iso.
  2. Once you have booted to the dvd/iso you are asked if you want to install CentOS or test the media.  If this is your first time installing with this iso, I'd recommend doing a quick test, otherwise, just continue with the install.
  3. You will see a lot of text come across the screen shortly followed by a graphical screen asking you for your install language.
  4. Next set your time zone, for myself, I will be choosing America, Boise.

  5. Next we will select the Software that we want to Install.  For our Install today, we are going to Use the GNOME Desktop for our choice.  I would also recommend the following add-ons for the environment:
    1. GNOME Applications
    2. Internet Applications
    3. Office Suite and Productivity
    4. Development Tools
    5. Security Tools

  6. Next we need to select our Installation Destination
    1. On our system, we have 2 hard drives.  1 100 Gb Hard Drive, and 1 20 Gb Hard Drive.  We will be installing our system on our 100 Gb Hard Drive.  Also, we will be doing a custom partitioning scheme.
    2. For our partition scheme we will use the following partition setup:
      • Mount Point Device Name Device Size Partition Type
        /boot /dev/sda1 1 GB ext4
        /var /dev/mapper/rootlv-var 10 GB ext4
        /tmp /dev/mapper/rootlv-tmp 10 GB ext4
        /opt /dev/mapper/rootlv-opt 30 GB ext4
        / /dev/mapper/rootlv-root 30 GB ext4
        /home /dev/mapper/rootlv-home 19 GB ext4
    3. The reason for this setup is several fold, and I won't go into deep detail here, but to suffice it to say, the following setup gives us maximum flexibility and better expansion in case space is needed in the future.
      1. In order to create these mount points follow the screenshots below:
      1. You will see the following screen, go ahead and accept the changes














      2. The past few steps with setting up the partitioning may seem a little confusing to begin with, but I will go into the use of LVM and the pros and cons of LVM vs. Posix Partitioning in another post.
  1. Now we begin our install
















  2. While the Install goes, we will set a root (administrator) password, and we will create our user account.
  3. Now sit back and enjoy the rest of the install

Tuesday, August 4, 2015

Linux - What is it good for?

So a lot of people have been hearing about this things called "Linux."  I've found that when working with many of my IT coworkers there is a lot of confusion about Linux in the community, even among IT professionals.

So, what is Linux?

Linux, simply is an alternative operating system to the traditional MS Windows or Mac OS.  In a nut shell, it gives you a third mainstream alternative for desktop and server environments.

But while simply explained as an alternative, there is a lot more to Linux that meets they eye, and this is where the confusion stems from.

Unlike Windows or Mac OS, Linux is not driven by a single company or entity.  Linux uses GPL, GNU General Public License.  Simply put, instead of trying to prevent anyone from looking at your code and making everything proprietary and closed, Linux is an open system where anyone can take the code, modify it, tweak it, and then re-release it, as long as the keep it under the GPL.  This has caused for many different versions (generally called distros, but sometimes referred to as flavors) of Linux to creep up over the years.  This has caused there to be a distro count over over 250 currently.  So why so many distros?  What's the point of them, why have so many people tweaked a simple operating system so much?

With such a variety of distros out there, it is important to start to understand the ethos behind some of these distros to understand why there are so many distros.


Distro Ethos
Ubuntu Ubuntu is an ancient African word meaning ‘humanity to others’. It also means ‘I am what I am because of who we all are’. The Ubuntu operating system brings the spirit of Ubuntu to the world of computers.
Red Hat Built for the modern datacenter.
To put your enterprise in a position to win, you have to break down the barriers that hold you back. With Red Hat® Enterprise Linux®, a platform with unparalleled stability and flexibility, you can reallocate your resources toward meeting the next challenges instead of just maintaining the status quo.
CentOS The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL).
Fedora Freedom. Friends. Features. First.
Fedora is always free for anyone to use, modify, and distribute. It is built and used by people across the globe who work together as a community: the Fedora Project.
SLES The Advanced Foundation for Your Success
openSuse openSUSE is a free and Linux-based operating system for your PC, Laptop or Server. You can surf the web, manage your e-mails and photos, do office work, play videos or music and have a lot of fun!

Here we see a few of the major lead contenders in the Linux world.   From these, we can see that the purpose of these myriad distros is widespread.  You have Red Hat and SLES which focus more on corporate customers, and they make money through support contracts.  In order to keep within the GPL, they have their opensource alternatives, CentOS/Fedora and openSuse respectively.

CentOS focuses more on business stability and very closely mirrors RHEL.  Fedora, while still based on RHEL is more focused on being more bleeding edge, and is somewhat of a testing ground for future RHEL features, drivers, and other enhancements.

There are always pros and cons to the different distros, and when selecting which distro to run it is important to determine beforehand what it is that you want to do.  For desktop environments, openSuse, Fedora, or Ubuntu might be the better choices.  For server grade without paying a subscription, CentOS or Ubuntu are great choices.  For Enterprise Level support in conjunction with Linux, SLES or Red Hat are great choices.

And with all of these, there are still other distros based on them that may make great choices, such as Edubuntu, Kubuntu, Linux Mint.

While there is much more to Linux to be learned about, that will be covered in the future as we investigate how to install, configure, and other uses for different distros.

Next time we will go into how to install Ubuntu, openSuse, CentOS, and Fedora.

~SLT