check_jmx4perl in icinga2 Configuration

This forum was archived to /woltlab and is now in read-only mode.
  • I have installed jmx4perl in my Icinga server and deployed jolokia agent on local tomcat server. I have tested the check_jmx4perl plugin which works fine but when configuring in Icinga and upon reloading, I am facing the following error



    Redirecting to /bin/systemctl reload icinga2.service

    Job for icinga2.service failed because the control process exited with error code. See "systemctl status icinga2.service" and "journalctl -xe" for details.


    Below is my configuration


    services.conf

    ---------------------------------------------------------

    apply Service "check_methodserver_heapmemory" {

    import "generic-service"

    check_command = "check_jmx4perl"

    vars.url = "http://localhost:8080/jolokia"

    vars.mbean = "java.lang:type=Memory"

    vars.attribute = "HeapMemoryUsage"

    vars.path = "used"

    vars.base = "java.lang:type=Memory/HeapMemoryUsage/max"

    vars.warning = "80"

    vars.critical = "90"

    assign where host.name == NodeName

    }


    commands.conf

    -----------------------------------------------

    object CheckCommand "check_jmx4perl" {

    import "plugin-check-command"

    command = [PluginDir + "/check_jmx4perl"] arguments = {

    "-u" = "$url$"

    "-m" = "$mbean$"

    "-a" = "$attribute$"

    "-p" = "$path$"

    "-b" = "$base$"

    "-w" = "$warning$"

    "-c" = "$critical$"

    }

    }


    Please let me know if my configuration is incorrect

  • 1.) Why don't you use the jmx4perl CheckCommand definition already inside the ITL?

    2.) What's the output of the config validation (icinga2 daemon -C)?

  • dnsmichi : I have exeuted icinga2 daemon -C and it gives the following error


    Code
    1. information/cli: Icinga application loader (version: v2.6.3)
    2. information/cli: Loading configuration file(s).
    3. critical/config: Error: syntax error, unexpected T_IDENTIFIER, expecting '}'
    4. Location: in /etc/icinga2/conf.d/commands.conf: 42:44-42:52
    5. /etc/icinga2/conf.d/commands.conf(40): object CheckCommand "check_jmx4perl" {
    6. /etc/icinga2/conf.d/commands.conf(41):  import "plugin-check-command"
    7. /etc/icinga2/conf.d/commands.conf(42):  command = [PluginDir + "/check_jmx4perl"] arguments = {
    8.                                                                                   ^^^^^^^^^
    9. /etc/icinga2/conf.d/commands.conf(43):   "-u" = "$url$"
    10. /etc/icinga2/conf.d/commands.conf(44):   "-m" = "$mbean$"
  • dnsmichi : Thanks keeping arguments in the new line resolved the issue, when I tried to reload and refresh Icinga web the plugin output is displayed with the critical state as following


    Can't locate Params/Validate.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/share/perl5/Monitoring/Plugin/Functions.pm line 11.

    BEGIN failed--compilation aborted at /usr/local/share/perl5/Monitoring/Plugin/Functions.pm line 11. Compilation failed in require at /usr/lib64/nagios/plugins/check_jmx4perl line 9. BEGIN failed--compilation aborted at /usr/lib64/nagios/plugins/check_jmx4perl line 9.


    Is this because of any dependency issue?