I am using icinga web2. There is a requirement that a particular log file under a directory needs to be checked by icinga. It seems that this particular plugin, https://www.monitoring-plugins.org/doc/man/check_file_age.html can be a potential candidate.
If any one has actually implemented this scenario in icinga, please let me know how it was done.
Hi
Welcome to Community Good Day!
how exactly you want to use the plugin as your subject indicates you want to enable notification
can you be more specific
check_file_age is a plugin to check to file to find out the modification time of the file and size
Please check the below example using file_age in ITL
I am using director way
you can give threshold as per your needs
apply Service “file_age” {
import “file_age_templ”
assign where "Linux-Servers_Testing" in host.templates
vars.file_age_file = "/var/log/monitor_*.log"
import DirectorOverrideTemplate
Are you trying to add this to the director yourself?
If so, you will need to modify the command in director to have a field for file_age_missing, and then under arguments set the value of the flag to file_age_missing
Below is an example using a different command that I have on hand:
Hi, Ben !
This is not self defined command, it is in the list of external commands imported by icinga director.
If you have any idea how to modify an external command I would be very thankful.
Regards Martin
iirc external commands are just commands that were defined in ITL format – you should be able to clone the external command you have (preserve imports) and then modify it it in director as needed.
Hi !
I solved it by creating a custom data field named “file_age_ignoremissing” as a boolean and added it as an optional field to the external command.
via the apply rule I can now choose this ignore flag and get the desired result.