Icinga2 check_flexlm

Hello,
my Icinga environment works very well and I am also very happy with it.
I would like to do an additional check for one of our license servers for the licenses that run under the lmstat daemon.
According to the documentation there is a prefabricated Icinga Template Library - Icinga 2 teamplate.
I have integrated the check as follows:

object Service "flexlm" {
  display_name = "FlexLM - Test"
  host_name = "XY"
  check_command = "flexlm"
  vars.flexlm_licensefile = "C:/tmp/flexlm-CREOVIEW.lic"
}

Unfortunately, the check does not work like this and I get the error message
Command "C:\Program Files\ICINGA2\/sbin/check_flexlm" -F C:/tmp/test.lic failed to execute: 2, "The system cannot find the file specified."

Unfortunately, there is no check_flexlm.exe under the Windows agent in the path C:\Program Files\ICINGA2/sbin/
I am sure that the error message does not mean that it cannot find the .lic file, because it is certainly under C:\tmp I think it cannot find the check_flexlm file.

Im not sure, if I have to add something but the docs refer to Monitoring Plugins - check_flexlm
There you can also download a file

image

Do I have to add this File on my Agent in C:\Program Files\ICINGA2/sbin/ ?

yes, you need the platform specific executable on machine which executes the check.

It is not a problem even if it is a .pl file and not an exe?
I will try to copy the file into the folder. I have just seen that the .pl file has to be adapted a bit because certain variables have to be set.
I’ll get back to you when I’ve tested it. Thanks

you need something that is executable.
things you can do with the perl script:

  • convert it to an executable somehow
  • change the command definiton to run the perlinterpreter with the script as parameter

Thank you @moreamazingnick

I struggled a bit but finally found a good solution that works in my environment.

I had problems converting the perl file to an exe, so I modified the C:\Program Files\ICINGA2\share\icinga2\include\command-plugins.conf file to run a perl instead of an exe.
The finished and customised command looked like this:
Perl is opened and the check_flexlm Perl script + licence path are specified using the arguments.

object CheckCommand "flexlm" {
	command = [  "C:/Strawberry/perl/bin/perl.exe" ]

	arguments = {
	    "C:/Program Files/ICINGA2/sbin/check_flexlm.pl" = ""
		"-F" = {
			value = "$flexlm_licensefile$"
			description = "Name of license file (usually license.dat)"
			required = true
		}
		"-t" = {
			value = "$flexlm_timeout$"
			description = "Plugin time out in seconds (default = 15)"
		}
	}
}

I hope I can help all those who are facing the same challenge.