How to implement nrpe-external-master

I’m looking for someone that can explain how I would implement nagios “nrpe-external-master” interface?

I have a charm which I would like to provide some checks for via that interface, but I’m not sure how I would need to interact in that interface.

@jnsgruk @jameinel

It looks like the documentation needs to be more visible, but https://github.com/juju/charm-helpers/blob/master/charmhelpers/contrib/charmsupport/nrpe.py#L44 has the details.

We should update this so it’s properly rendered as docs on charmhelpers.contrib.charmsupport package — Charm Helpers 0.20.10 documentation and then reference that from Deploy Nrpe using Charmhub - The Open Operator Collection.

@mthaddon I have tried to implement this for a few days now and got through many obstacles.

Would you be able have a short hangout session with me to go through the pieced that I don’t get?

I have compressed it ibto a charm I can share with you.

Sure, will co-ordinate on the charmhub chat site.

I’ve created https://github.com/juju/charm-helpers/pull/672 to improve the documentation on charmhelpers.contrib.charmsupport package — Charm Helpers 0.20.10 documentation.

Can you add @hallback to the meeting aswell? I sent him the meeting link, but I’m not sure it works unless you invite him.

I’ve made a change to the repo, but I still have to remove and add back the relation for my check to appear.

juju remove-relation nrpe monitoring-nrpe juju add-relation nrpe monitoring-nrpe

As you can see in the image.

I can’t understand what I’m doing wrong.

Here is the code in the “nrpe” branch. https://github.com/erik78se/juju-operators-examples/blob/nrpe/monitoring-nrpe/src/charm.py

I’ve filed Bug #1958966 “deploy instructions on charmhub don't configure de... : Bugs : NRPE Charm and will follow up on this, I was able to reproduce the issue with the ubuntu charm not displaying default checks.

Will continue looking at the other issue soon.

In terms of the issue with a relation between monitoring-nrpe and nrpe, I think this is the fix you’re looking for:

And then the following deployment instructions (having run a charmcraft pack):

juju deploy nagios
juju deploy nrpe
juju deploy ./monitoring-nrpe_ubuntu-20.04-amd64.charm
juju relate nagios:monitors nrpe:monitors
juju relate monitoring-nrpe:local-monitors nrpe

Doing that I see the juju-monitoring-nrpe-0-hellocheck check configured first time in the nagios web interface.

The reason is that the nrpe-external-master relation doesn’t actually pass data over the relation to tell the nagios charm what to check. It creates a text file in /var/lib/nagios/export/ and is expecting the nagios instance to rsync that (I verified that when I created the nrpe-external-master relation, those files were in that directory as expected).

What you showed me last night was using a relation from monitoring-nrpe to nrpe and from nrpe to nagios. In this case, we need those relations to pass the information for us, so we need to use the local-monitors relation rather than the nrpe-external-master relation.

Hope that clarifies things.

I think the reason we’re not getting basic checks is something to do with running on LXD, but will wait for an update on that bug I filed to confirm.

1 Like

This is massive help and I’m testing it out as we speak! If this works, I’m happy to run through a worskshop next week showing how to implement this in a charm if you would like to join and make the session very interactive.

My first attempt failed, since this construction related to nrpe:nrpe-external-master… I’m trying with a new deploy now being explicit to use the nrpe:local-monitors instead. See if that works.

Still no luck in getting the check to appear on my first deploy even with the changes you proposed… I’ve updated my repo in the nrpe branch if you wan’t to see.

I made an error, not changing the interface in the metadata.yaml to “local-monitors”.

After fixing that error, I do get the correct result! Thanx alot - this is really great! It provides a means to actually implement this in my charms now!