How to check if an External Hard Drive is mounted?

Hi all,

Please can somebody help me out with this.
I know it’s probably so easy to get done, but I am somebody who doesn’t really understand the Icinga system totally and I am trying to get the grips of it. This system was inherited from a previous IT Manager who passed away and I’ve been tasked with taking care of the system or bettering it. From what I’ve seen so far, this system is so well organized and just boasts awesome features - so I definitely do not want to replace it.

Please can somebody help me figure out how I can setup an addon/plugin in Icinga2 that allows me to check to see if an external hard drive is mounted on my debian servers? We usually mount the backup drives to the same mount point (/media/EXTERNAL).

I’ve searched around and found few plugins check_mount.pl and check_mount.sh… I downloaded them but I don’t know how to install it.
If I run the commands ./check_mount.pl -p /media/EXTERNAL
I get the message that the hard drive is mounted.
and the same applies for the other .sh file I have, but I don’t know where to put these files or how to implement them with Icinga2 such that it reads Warning/Critical errors etc.

I hope this all makes sense.

PS. Do any of you know of any awesome video tutorials/courses for Icinga2?

Hi and welcome :slight_smile:

The general steps to have a new check script working with Icinga are:

  • create a new check command with the required arguments
  • create a new service template that uses the check command
  • create a new service check (e.g by apply rule) and pin the check to a host object.

As for tutorials I can’t really recommend any, because the ones I used some years ago will most likely be outdated.
I suggest you check on youtube for some videos. You will find some from Netways, which are good but in German.

I think reading the docs will get you started as well in how Icinga is organized:
https://icinga.com/docs/icinga-2/latest/doc/03-monitoring-basics/
https://icinga.com/docs/icinga-2/latest/doc/04-configuration/
https://icinga.com/docs/icinga-2/latest/doc/05-service-monitoring/

You could also look for training from Icinga partners, if there are any suitable for you:

If you read the docs, watch a tutorial or two and try fiddling around with the configuration yourself you will make progress and can ask here if you get stuck on specifics :slight_smile:

Many thanks.
I do appreciate your help.

I’ve been reading through the docs and obviously I don’t understand it very well. There’s no step by step instructions in the docs that show me how to do this. At least none that I’ve come across.

This being a live environment I obviously don’t want to play trial and error. Do you think it’s possible you can show me step by step on how to check if an external hard drive is mounted on one of our servers on the network? Lets assume I do not have these .sh and .pl plugins/addons/modules. How would one go about programming this from scratch?

The system is working well so far, I just wanted to add this feature to it - just don’t know where to start and I don’t want to mess up the live environment.

Thank you for your response though, I do appreciate it.

And I a step-by-step tutorial on such a specific matter like “checking if something is mounted and how to write a script to check that”.
Apart from following some guidelines (e.g exit codes, output format) you can choose nearly any language and any method to get the information you want.

As you already have two working scripts that do what you want you “just” have to get them working, meaning

Not wanting to play in a production system is totally valid, that’s why I would recommend setting up a small test system yourself. With this you can

  • learn how to install icinga2
  • try yourself on the configuration files
  • maybe try the icinga Director to have a graphical config interface
  • explore other icinga modules

I believe that learning by doing, watching/reading some tutorials and the docs are the best ways to get to know the system. Apart from having a intructor-led course maybe :slight_smile: