Donnerstag, November 03, 2016

How to set up a monitoring solution within an hour

I recently got tasked to get familiar with Mathias Kettner’s “Check-MK” (http://http://mathias-kettner.com/) to help a customer with his installation. This is a tutorial to get you started within an hour instead of days. For obvious reasons you will need some fine tuning later. Let’s get started with the basic install and the discovery of your first device which will give you quite impressive results.

Installation

  1. Get some kind of hypervisor. KVM or Virtualbox is fine. 
  2. Create a virtual machine with 2GB RAM and 8GB disk. Make sure the network runs in bridged mode. Make sure that the NIC runs as "virtio-net" device.
  3. Get a decent Linux distribution. Personally I prefer Debian or CentOS but other distributions will work as well. Stick with a minimal install CD as the OS will run headless.
  4. Install the OS. I chose automatic partitioning which included LVM. 
  5. Install some packages. You wil need: "yum install deltarpms wget mc vi"
  6. Upgrade your system to the latest version by executing "yum upgrade".
  7. Always onfirm the installation of necessary repository keys.
  8. Before we start the actual install we need some extra stuff: "yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm"
    This will solve some required dependencies. Confirm the installation of the EPEL key.
  9. Download the latest stable RAW Edition:
    Link:
    http://mathias-kettner.com/check_mk_download.php?HTML=yes
    In my case it is 1.2.8p12 which resolved to:
    "wget https://mathias-kettner.de/support/1.2.8p12/check-mk-raw-1.2.8p12-el7-36.x86_64.rpm"
  10. Install the downloaded packages:
    "yum localinstall check-mk-raw-1.2.8p12-el7-36.x86_64.rpm"
    After a few minutes all packages should be installed. Again – confirm necessary keys.
  11. Get rid of SElinux by disabling it or by setting it to permissive by editing "/etc/sysconfig/selinux".
  12. Create and start the site "homenet"
    "omd create homenet"
    "omd start homenet"

Configuration

  1. Open you browser and surf to http://ip-address/homenet
  2. Username: omdadmin password: omd
  3. Deploy the first monitoring agent to a device: Scroll down to "Monitoring agents" – select the Windows .msi installer, download it to a windows machine and install it. Make sure that TCP port 5667 is open on the windows machine.
  4. Under "WATO – Configuration" – click on "Hosts". Click "Create new hosts". Enter the hostname or IP of the windows machine and click "Save & finish". Click on "Bulk discovery : Start". After a while it should state that it found services. Click "Finish". After you have successfully discovered a windows machine you need to add it to the monitoring. Click on "1 changes" and "Activate changes!".
  5. Wait a few seconds and then go to "Views – Hosts – All hosts".
    Voilá! It should now display your first discovered and monitored device. 


Comments

NTP

The monitoring machine needs a precise clock time adjustment. Either you stick with a virtual machine. Then you must install the necessary guest add-ons from Virtualbox. OR: You use a physical machine. Then you must install ntpd.


VIRTUALBOX ADD-ON

To improve the overall virtualbox performance you should install the add-ons.
Install DKMS: "yum install dkms"
"Insert" the guest add-on disk by selecting the menu entry in virtualbox.
Mount the cdrom: "mount /dev/sr0 /media"
Install the required add-on by automatically compiling it:
"cd /media"
"./VBoxLinuxAdditions.run"
"cd /"
"umount /media"


SMTP
Of course you want to get notified if your monitored devices run into trouble. Therefore you must configure a SMTP relay host to send emails.