We were recently asked how to dynamically monitor folders with Icinga.
Several of our clients monitor folders whose names change from day to day. For example, suppose every day I want to see if there is a file named with the date of that particular day, or I’d like to see if there is a folder for the current day, etc. This need arises on the file servers that our customers normally manage with Windows Server.
We’ve found that one quick approach to solving this type of problem is to use Icinga DSL.
In the past, other colleagues of ours have used Icinga DSL for similar dynamic tasks. You can refer to this blog to find out more about Icinga DSL and how to use it:
We chose to use the command Invoke-IcingaCheckDirectory, which is used to check the directory and the files in a path using Powershell. This topic has also already been discussed in another recent blog:
1: Duplicate command: duplicate the command Invoke-IcingaCheckDirectory
2. Change argument: click on the Arguments tab and change the path using for example this configuration shown in this screenshot:
How can we test the correct syntax and output of this Icinga DSL command?
It’s simple: you can use the Icinga Console. Open an SSH session on NetEye and type this command:
[root@neteyedemo ~]# icinga2 console
Icinga 2 (version: r2.11.9-1)
Type $help to view available commands.
<1> => DateTime().format("c:\\%Y\\%m\\%d")
"c:\\2021\\10\\20"
<2> =>
Inside Icinga Console it’s possible to run Icinga DSL commands and see their output. In this simple example, we’ll check the Windows Directory on the Windows Server and verify the path with year month and day.
You can extend this example to files and folders of different types, and in general to other commands.
Hi, I’m Franco and I was born in Monza. Over the last 20 years I worked for IBM in various roles. I started as a customer service representative (help desk operator), then I was promoted to Windows expert. In 2004 I changed again and was promoted to consultant, business analyst, then Java developer, and finally technical support and system integrator for Enterprise Content Management (FileNet). Several years ago I became fascinated by the Open Source world, the GNU\Linux operating system, and security in general. And so in the last 4 years during my free time I studied security systems and computer networks in order to extend my knowledge. I came across several open source technologies including the Elastic stack (formerly ELK), and started to explore them and other similar ones like Grafana, Greylog, Snort, Grok, etc. I like to script in Python, too. In addition to studying in my free time I dedicate myself to my family (especially my little daughter) and I like walking, reading, dancing and making pizza for friends and relatives.
Author
Franco Federico
Hi, I’m Franco and I was born in Monza. Over the last 20 years I worked for IBM in various roles. I started as a customer service representative (help desk operator), then I was promoted to Windows expert. In 2004 I changed again and was promoted to consultant, business analyst, then Java developer, and finally technical support and system integrator for Enterprise Content Management (FileNet). Several years ago I became fascinated by the Open Source world, the GNU\Linux operating system, and security in general. And so in the last 4 years during my free time I studied security systems and computer networks in order to extend my knowledge. I came across several open source technologies including the Elastic stack (formerly ELK), and started to explore them and other similar ones like Grafana, Greylog, Snort, Grok, etc. I like to script in Python, too. In addition to studying in my free time I dedicate myself to my family (especially my little daughter) and I like walking, reading, dancing and making pizza for friends and relatives.
With the end of 2021 we've release the first version of the NetEye Extension Packs project that helps customers and consultants on their monitoring implementations and more (see Introducing NetEye Extension Packs | www.neteye-blog.com for details). Now our focus is Read More
Today my objective is to collect the performance metrics from various NetEye Icinga checks and write them out to Elasticsearch so I can apply Machine Learning (ML) algorithms to identify potential anomalies. This is a task that's not possible with Read More
Sometimes you'd just really like to have an overview of what happens to the Events that flow through Tornado. Where do they come from? Did they get stuck somewhere in the Collectors or in Tornado? Which Tornado Actions did they Read More
When I'm running a service which processes a lot of data, sooner or later I start to wonder: what is the service doing? What data is it processing? This also applies to our event processor Tornado. For the Tornado Engine, Read More
Together with the NetEye 4.21 release, we also released NEP (an abbreviation that stands for NetEye Extension Packs) and now it’s possible to install it using the RPM present in the Official NetEye Repositories. If you are interested in this Read More