gorantornqvist/nagios-plugins

How to configure on Icinga?

Closed this issue · 1 comments

Hi again,
I've been trying all day to configure this script in icinga and I don't get it, I always get the error:

UNKNOWN - request failed - Error when contacting TrueNAS server: (, HTTPError('401 Client Error: Unauthorized for url: https://192.168.3.235:443/api/v2.0/alert/list/'), )

/etc/icinga2/zones.d/COLT-RZ/local-conf/commands.conf

object CheckCommand "truenas" {
         import "plugin-check-command"
         command = [ PluginDir + "/check_truenas.py", "-H", "$truenas_host$", "-u", "$truenas_user$", "-p", "$truenas_pass$","-t", "$truenas_type$", "-nv", "-ns" ]

         arguments = {
                 "-H" = "$truenas_host$"
                 "-u" = "$truenas_user$"
                 "-p" = "$truenas_pass$"
                 "-t" = "$truenas_type$"
                 "-pn" = "$truenas_zpoolname$"
                 "-ns" = "$truenas_nossl$"
                 "-nv" = "$truenas_noverifycert$"
                 "-zw" = "$truenas_zpool-warn$"
                 "-zc" = "$truenas_zpool-crit$"
                 "-zp" = "$truenas_perfdata$"
         }

         vars.truenas_host = "$address$"
         vars.truenas_user = "root"
         vars.truenas_type = "alerts"
}

/etc/icinga2/zones.d/COLT-RZ/services/coltnas.conf

apply Service "truenas-alerts" {
        import "generic-service"
       assign where match ("coltnas*", host.name)
        check_command = "truenas"
        vars.truenas_host = "192.168.3.235"
        vars.truenas_pass = "12345"
        vars.sla = "24x7"
}

what am I forgetting? Manual works..

nagios@coltmon:~$ /usr/lib/nagios/plugins/check_truenas.py -H 192.168.3.235 -u root -p 12345 -t alerts -nv 
OK - No problem alerts

sorry, I mistake plugin github page :P