Monitor Nutanix with Check_MK (OMD)

      9 Comments on Monitor Nutanix with Check_MK (OMD)

A while ago, I tried to monitor our Nutanix Cluster with Check_MK by using SNMP.
So I started by writing some simple checks for it, but I wasn’t satisfied with the results.

So I was wondering what the possibilities would be by using the Nutanix REST-API.
I could tell you how difficult is was how to create the specialized agent for Check_MK, but I think that you are more interested in the end result.

Note: This guide is written for Debian 8 and written for a non-root user.
Commands that require elevated privileges are prefixed with [sudo]

The Nutanix Check_MK Package

First you need to download the custom build check. You can do that by clicking right here.

Install the Check_MK Package

The second step is to install the package on your Check_MK server.
Copy the package with for example “WinSCP” to the tmp-directory on Check_MK server

Open a SSH-session and log into your OMD site.

Install the MKP-package and check if the package is installed successfully

Your output will look similar to the following

Now that the package is installed let’s add the Nutanix cluster into Check_MK

Create a Host

Open the Check_MK Webpage and go into “WATO”.
Add an Nutanix Cluster by choosing “Hosts” , “New host”.

  • Enter a “Hostname”
  • Add your “IP or FQDN address”
  • Set the Agent Type for “Check_MK Agent”
  • Save & Finish

The Agent

Activate the specialized agent to start monitoring the Nutanix cluster.
Go to “Host and Service Parameters”, “Datasource Programs” and select “Check Nutanix via REST-API”

Create a new “Rule”. Leave it on “Main directory”

  • Use the “Host Address” or a “IP or FQDN”
  • Enter Nutanix Username with Password
  • Select your current hypervisor (Acropolis or vSphere)
  • Select one of the features you would  like to monitor
  • Save

Let’s go back to our Nutanix host and check if it has found some new “Unmonitored Services”

Add Services

As you can see it has found 5 new “Services”.

Go into “WATO”, “Edit” your host and open “Services”

Click “Activate missing” to start monitoring the services below.

Result

When we now go back to our Nutanix host you can see that services are active and your Nutanix cluster is monitored by Check_MK.

I hope this Nutanix check is useful for your Check_MK environment as it is for me.
This is not a finished product so if you have some suggestions or tips, just leave a comment below.

Thanks for reading.

9 thoughts on “Monitor Nutanix with Check_MK (OMD)

  1. Bill Sanborn

    Kevin,

    Thanks for your efforts on this! We’re long-time CMK users and any additional information we can grab from our Nutanix infrastructure is wonderful.

    I did run into an issue. We’re using version 1.2.6 P1 and I got this error when doing a services check:

    Service discovery failed for this host: Agent exited with code 1: Traceback (most recent call last): File “/omd/sites/prod/local/share/check_mk/agents/special/agent_ntnx”, line 358, in sys.exit(main()) File “/omd/sites/prod/local/share/check_mk/agents/special/agent_ntnx”, line 332, in main x.cluster_info() File “/omd/sites/prod/local/share/check_mk/agents/special/agent_ntnx”, line 96, in cluster_info raw_info = self.get_server_session(url) File “/omd/sites/prod/local/share/check_mk/agents/special/agent_ntnx”, line 57, in get_server_session context = ssl._create_unverified_context() AttributeError: ‘module’ object has no attribute ‘_create_unverified_context’”

    Reply
    1. Kevin Tijssen Post author

      Bill,

      Sorry for the late response I was on a holiday for a couple of weeks but thanks for your comment.
      I have tested it with your version but I didn’t receive any error’s

      My first gues is that you python version is outdated cause is failing on the “SSL” module.
      My advice for you is to upgrade to the latest version of Check_MK.

      Regards,
      Kevin

      Reply
  2. Mukarram

    Thank you very much for this plugin! It works beautifully.
    However the VMs are not showing up in the checks.
    I am running CheckMK Enterprise Check_MK 1.4.0p15
    Regards!

    Reply
    1. Kevin Tijssen Post author

      You also need to add the VMs in CheckMK. The names need to be exactly same ( lower-/uppercase) as in you Nutanix Cluster cause they are piggybacked.

      Reply
  3. marcel

    Hi kevin ,

    I think it is not an error but .. Our Nutanix has an alert :
    “The affected VMs list is: {vm_names}” so
    ~/local/share/check_mk/agents/special/agent_ntnx crashed :

    Traceback (most recent call last):
    File “…./local/share/check_mk/agents/special/agent_ntnx”, line 445, in
    sys.exit(main())
    File “…./local/share/check_mk/agents/special/agent_ntnx”, line 420, in main
    x.alert_info()
    File “…./local/share/check_mk/agents/special/agent_ntnx”, line 140, in alert_info
    alertMessage = alert[‘message’].format(**dict(alertContext))
    KeyError: u’vm_names’

    If i commend out like this :
    # alertMessage = alert[‘message’].format(**dict(alertContext))
    alertMessage = alert[‘message’]

    it is working.
    rg
    marcel

    Reply
    1. Kevin Tijssen Post author

      Hi Marcel, Thanks for the info. I also encountered this issue but apparently its the output from NCC thats causing this. I haven’t found a solution for this issue. When you acknowledge the alert the check is fuctioning normally. How is the check working for you? Do you get all the info or are you missing something? If so please let me know. Regards,
      Kevin

      Reply
  4. Michael

    Hey Kevin,
    would it be possible for you to update the plugin for the latest AOS?
    Unfortunately it has not worked properly since 5.6.

    Reply
    1. Kevin Tijssen Post author

      Hi Michael,
      Unfortunately I don’t have AOS 5.6 currently running on any of our system. We’re at 5.5.5.
      I’ll send you a PM to have a look at you’re problem.
      Regards, Kevin

      Reply
  5. Thomas

    hi Kevin
    Happy 2019!!
    I like your plugin alot and i’ve been using it for a while now (somewhere since 3.x..)
    But unfortunately the container checks do not work anymore on CMK 1.5(i use p9), it used to be working in 1.4(until p31).
    It says WARNING: Exception in discovery function of check type ‘ntnx_container’: need more than 8 values to unpack
    All other checks work (i.e. ntnx_alerts, ntnx_cls_info , ntnx_cls_ncc, ntnx_cls_rsc.cpu, ntnx_cls_rsc.iobw, ntnx_cls_rsc.iolatency, ntnx_cls_rsc.iops, ntnx_cls_rsc.mem)
    I use v4 of the plugin

    BR Thomas

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *