Nagios is from Mars, and MySQL is from Venus (Monitoring Part 2)

In my previous post about Nagios, I showed how the rich Nagios charm simplifies adding basic monitoring to Juju environments. But, we need more than that. Services know more about how to verify they are working than a monitoring system could ever guess.

So, for that, we have the ‘monitors‘ interface. Currently sparsely documented, as it is extremely new, the idea is simple.

  • Providing charms define what monitoring systems should look at generically
  • Requiring charms monitor any of the things they can, ignoring those they cannot.

This is defined through a YAML file. Here is the example.monitors.yaml included with the nagios charm:

# Version of the spec, mostly ignored but 0.3 is the current one
version: '0.3'
# Dict with just 'local' and 'remote' as parts
monitors:
    # local monitors need an agent to be handled. See nrpe charm for
    # some example implementations
    local:
        # procrunning checks for a running process named X (no path)
        procrunning:
            # Multiple procrunning can be defined, this is the "name" of it
            nagios3:
                min: 1
                max: 1
                executable: nagios3
    # Remote monitors can be polled directly by a remote system
    remote:
        # do a request on the HTTP protocol
        http:
            nagios:
                port: 80
                path: /nagios3/
                # expected status response (otherwise just look for 200)
                status: 'HTTP/1.1 401'
                # Use as the Host: header (the server address will still be used to connect() to)
                host: www.fewbar.com
        mysql:
            # Named basic check
            basic:
                username: monitors
                password: abcdefg123456

There are two main classes of monitors: local, remote. This is in reference to the service unit’s location. Local monitors are intended to be run inside the same machine/container as the service. Remote monitors are then, quite obviously, meant to be run outside the machine/container. So, above, you see remote monitors for the mysql protocol and http, and a local monitor to see if processes are running.

The MySQL charm now includes some of these monitors:

version: '0.3'
monitors:
    local:
        procrunning:
            mysqld:
                name: MySQL Running
                min: 1
                max: 1
                executable: mysqld
    remote:
        mysql:
            basic:
                user: monitors

The remote part is fed directly to nagios, which knows how to monitor mysql remotely, and so translates it into a check_mysql command. The local bits are ignored by Nagios. But, when we also relate the subordinate charm NRPE to a MySQL service, then we’ll have an agent which understands local. It actually converts those into remote monitors of type ‘nrpe’ which Nagios does understand. So upon relating NRPE to Nagios, each subordinate unit feeds its unique NRPE monitors back to Nagios and they are added to the target units’ monitors.

Honestly, this all sounds very complicated. But luckily, you don’t have to really grasp it to take advantage of it in a charm. The whole point is this: All one needs to do is write a monitors.yaml, and add the monitors relation with this joined hook to your charm:

#!/bin/bash
# .. Anything you need to do to enable the monitoring host to access ports/users/etc goes here
relation-set monitors="$(cat monitors.yaml)" target-id=${JUJU_UNIT_NAME//\//-} target-address=$(unit-get private-address)

If you have local things you want to give to a monitoring agent, you can use the ‘local-monitors’ interface, which is basically the same as monitors, but only ever used in container scoped relations required by subordinate charms such as NRPE or collectd.

Now you can easily provide monitors to any monitoring system. If Nagios doesn’t support what you want to monitor, its fairly easy to add support. And as more monitoring systems are charmed and have the monitors interface added, your charm will be more useful out of the box.

In the next post, which will wrap up this series on monitoring, I’ll talk about how to add monitors support to some other monitoring systems such as collectd, and also how to write a subordinate charm to communicate your monitors to an external monitoring service.

7 thoughts on “Nagios is from Mars, and MySQL is from Venus (Monitoring Part 2)

  1. I’m not certain thе plасe you’re getting your information, however great topic. I needs to spend a while learning more or working out more. Thanks for fantastic info I was in search of this information for my mission.

  2. Then melt that paragraph down to a single sentence. You could possibly sell to or through anyone anywhere in the world of working for yourself in your make money for free enterprise.

  3. I see you share interesting content here, you
    can earn some additional cash, your website has huge potential, for
    the monetizing method, just search in google – K2 advices
    how to monetize a website

  4. I read a lot of interesting posts here. Probably you spend a lot of time writing, i know how to save you a lot of time, there is an online tool that creates unique, google friendly posts
    in minutes, just type in google – laranitas free content source

  5. Gaining dominance in either is relatively cheaap and quick
    at present and companies that react quickly are likely to be able to
    reap rich rewards and grow intrinsically owing to the first mover advantage.

    It iss important to ensure that all services that you want to
    package in the campaign is in the approval document.

    Traditional broadcast approaches will not wlrk in a highly ersonal medium like the cell
    phone and marketers need to mae the mental shift from looking at the mopbile phone as a one
    way channel to mobile phones as a device
    for dialogue that creates deeper, richer brand experiences.

    Take a look aat my web blog: automobile code login php

  6. **TL;DR in bold** From the r/fitness wiki – "Billy is 22, 5’9 175cm , and 175lb 79kg and works out His estimated TDEE is 2450 but he wants to lose fat and gain muscle, so he is taking the advice given above" I thought gaining muscle and losing fat at the same time was not From this link , it would seem that you can gain muscle and lose fat if you go low carb not defined how low low is for 2-3 So what is the verdict, **can you lose fat and gain muscle?** **Are vegan proteins as good as meat proteins** if you get all the amino acids by For example, is hummus+whole wheat protein as good quality as chicken breast? I want to cut down on meat and go vegan but if the quality of proteins is not good enough, I don’t want to do **Is being able to lift more a sign of muscle buildup?** **My current stats** are : kg 151lbs , 170 cm 5’7 , BF% = Visceral fat = 7, Muscle = Resting metabolism = 1587 **Should I cut, maintain or gain? What are the normal weight gain/loss rates**? **My routine is chest, back, tricep, bicep, shoulder, leg mon-sat Any change needed?** **Should I add cooking oil calories to my calorie count**?

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>