Hi,

Thank you very much. This was the right hint.

The reason for not using the ITL plugin was because of an historic oriented 
migration from nagios and missing knowledge :-)

The now working config for me is:
object CheckCommand "check_nsclient" {
    import "plugin-check-command"

    command = [ PluginDir + "/check_nrpe" ]

    arguments = {
        "-H" = "$address$"
        "-t" = "20"
        "-c" = "$command$"
        "-a" = {
            value = "$arguments$"
            repeat_key = false
            order = 1
        }
    }
}

template Service "sys_windows_event_source_schannel_eventid_36887" {
    import "generic-service"

    check_command = "check_nsclient"

    vars.command = "check_eventlog"
    vars.arguments = [ "file=Application", "MaxWarn=1", "MaxCrit=2", 
"filter=id=36887", "scan-range=-7d", "unique", "syntax=ID: %id%, Source: 
%source%, File: %file%" ]
}

Kind regards and thanks again,
Peter

________________________________
From: icinga-users [icinga-users-boun...@lists.icinga.org] on behalf of Michael 
Friedrich [michael.friedr...@gmail.com]
Sent: Tuesday, July 21, 2015 11:25 PM
To: Icinga User's Corner
Subject: Re: [icinga-users] Check Windows EventLog with icinga2



Am Dienstag, 21. Juli 2015 schrieb LOEFFLER Peter :
Hi,

sorry. This is what i mean with "I already tried to configure the arguments as 
an array".

But here is the test case.


Config:
object CheckCommand "check_nsclient" {
        import "plugin-check-command"

        command = [ PluginDir + "/check_nrpe" ]

        arguments = {
                "-H" = "$address$"
                "-t" = "20"
                "-c" = "$command$"
                "-a" = "$arguments$"
        }
}

Any reason not to use the existing nrpe definition from the icinga2 ITL plugin 
check commands? The also handle "-a" arrays properly.

Kind regards,
Michael


template Service "sys_windows_event_source_schannel_eventid_36887" {
        import "generic-service"

        check_command = "check_nsclient"

        vars.command = "check_eventlog"
        vars.arguments = [ "file=Application", "MaxWarn=0", "MaxCrit=0", 
"filter=id=36887", "scan-range=-7d", "unique", "syntax=ID: %id%, Source: 
%source%, File: %file%" ]
}


Debug Log:
[2015-07-21 19:22:48 +0200] notice/Process: PID 9652 
('/usr/lib64/nagios/plugins/check_nrpe' '-H' '10.100.0.135' '-a' 
'file=Application' '-a' 'MaxWarn=0' '-a' 'MaxCrit=0' '-a' 'filter=id=36887' 
'-a' 'scan-range=-7d' '-a' 'unique' '-a' 'syntax=ID: %id%, Source: %source%, 
File: %file%' '-c' 'check_eventlog' '-t' '20') terminated with exit code 3
[2015-07-21 19:22:48 +0200] debug/DbEvents: add service check history for 
'pdc5.herold.intra!p_sys_windows_event_source_schannel_eventid_36887'


Result in Classic-GUI:
Unknown argument: -c


Command-line tests:
[r...@pmon01.lan.hbd icinga2]# '/usr/lib64/nagios/plugins/check_nrpe' '-H' 
'10.100.0.135' '-a' 'file=Application' '-a' 'MaxWarn=0' '-a' 'MaxCrit=0' '-a' 
'filter=id=36887' '-a' 'scan-range=-7d' '-a' 'unique' '-a' 'syntax=ID: %id%, 
Source: %source%, File: %file%' '-c' 'check_eventlog' '-t' '20'
Unknown argument: -c
[r...@pmon01.lan.hbd icinga2]# '/usr/lib64/nagios/plugins/check_nrpe' '-H' 
'10.100.0.135' '-t' '20' '-c' 'check_eventlog' '-a' 'file=Application' '-a' 
'MaxWarn=0' '-a' 'MaxCrit=0' '-a' 'filter=id=36887' '-a' 'scan-range=-7d' '-a' 
'unique' '-a' 'syntax=ID: %id%, Source: %source%, File: %file%'
No file specified try adding: file=Application


Regards,
Peter



________________________________________
From: icinga-users 
[icinga-users-boun...@lists.icinga.org<UrlBlockedError.aspx>] on behalf of 
Alexander Wirt [formo...@formorer.de<UrlBlockedError.aspx>]
Sent: Tuesday, July 21, 2015 6:07 PM
To: Icinga User's Corner
Subject: Re: [icinga-users] Check Windows EventLog with icinga2

On Tue, 21 Jul 2015, LOEFFLER Peter wrote:

> Hi,
>
> i'm trying build a check for a special windows event using NSClient++ and 
> check_nrpe.
> The problem is that icinga2 seems to quote every argument and the 
> check_eventlog plugin doesn't like it.
>
>
> Versions:
>
> [r...@pmon01.lan.hbd icinga2]# yum info icinga2
> Loaded plugins: fastestmirror, security
> Loading mirror speeds from cached hostfile
> Installed Packages
> Name        : icinga2
> Arch        : x86_64
> Version     : 2.3.5
> Release     : 1.el6
> Size        : 18 k
> Repo        : installed
> From repo   : icinga-stable-release
> Summary     : Network monitoring application
> URL         : https://www.icinga.org/
> License     : GPL-2.0+
> Description : Meta package for Icinga 2 Core, DB IDO and Web.
>
> [r...@pmon01.lan.hbd icinga2]# /usr/lib64/nagios/plugins/check_nrpe --help
>
> NRPE Plugin for Nagios
> Copyright (c) 1999-2008 Ethan Galstad 
> (nag...@nagios.org<UrlBlockedError.aspx>)
> Version: 2.15
> Last Modified: 09-06-2013
>
> [r...@pmon01.lan.hbd icinga2]# /usr/lib64/nagios/plugins/check_nrpe -H 
> '10.100.0.135' -t 20
> I (0,4,1,102 2013-07-15) seem to be doing fine...
>
>
> Config:
>
> template Service "sys_windows_event_source_schannel_eventid_36887" {
>         import "generic-service"
>
>         check_command = "check_nrpe_with_args"
>
>         vars.ARG1 = "check_eventlog"
>         vars.ARG2 = "file=Application MaxWarn=0 MaxCrit=0 filter='id=36887' 
> 'scan-range=-7d' unique 'syntax=ID: %id%, Source: %source%, File: %file%'"
        thats wrong. There isn't a shell involved, therefore every argument
        needs to part of a list. [ 'file=Application', 'MaxWarn=0', ... ]
        And so on.

        In facts the arguments aren't quoted, but since there isn't a shell
        involved they are not word splitted as you would see in a shell.

Alex
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org<UrlBlockedError.aspx>
https://lists.icinga.org/mailman/listinfo/icinga-users
[http://www.herold.at/images/hbdat_logo.gif]<http://www.herold.at>

HEROLD Business Data GmbH
Guntramsdorfer Straße 105
A-2340 Mödling

FN 233171z
Landesgericht Wiener Neustadt

[http://www.herold.at/fileadmin/gptw2-email.gif]<http://www.greatplacetowork.at>



Besuchen Sie uns online und mobil auf 
www.herold.at<http://www.herold.at><http://www.herold.at>!

Weitere Informationen zu unseren Produkten finden Sie unter:
http://www.herold.at/kundengewinnen/

oder auf YouTube:
https://www.youtube.com/user/HEROLDChannel

[http://www.herold.at/images/fb_icon_mail.gif]<http://www.facebook.at/derherold>Werden
 Sie Fan von HEROLD auf Facebook<http://www.facebook.at/derherold>!

Bleiben Sie top informiert mit den HEROLD Blogs:
http://www.herold.at/blog/
http://www.herold.at/blog/heroldforbusiness/

Bitte beachten Sie auch:
http://www.website-design.at
http://www.arztsuche24.at
http://www.bauwohnwelt.at
http://www.immoversum.com
http://www.tupalo.com
http://www.urlauburlaub.at



Diese E-Mail kann vertrauliche und/oder rechtlich geschützte Informationen 
enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte 
Weitergabe dieser Mail sind nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org<UrlBlockedError.aspx>
https://lists.icinga.org/mailman/listinfo/icinga-users

[http://www.herold.at/images/hbdat_logo.gif]<http://www.herold.at>

HEROLD Business Data GmbH
Guntramsdorfer Straße 105
A-2340 Mödling

FN 233171z
Landesgericht Wiener Neustadt

[http://www.herold.at/fileadmin/gptw2-email.gif]<http://www.greatplacetowork.at>



Besuchen Sie uns online und mobil auf www.herold.at<http://www.herold.at>!

Weitere Informationen zu unseren Produkten finden Sie unter:
http://www.herold.at/kundengewinnen/

oder auf YouTube:
https://www.youtube.com/user/HEROLDChannel

[http://www.herold.at/images/fb_icon_mail.gif]<http://www.facebook.at/derherold>Werden
 Sie Fan von HEROLD auf Facebook<http://www.facebook.at/derherold>!

Bleiben Sie top informiert mit den HEROLD Blogs:
http://www.herold.at/blog/
http://www.herold.at/blog/heroldforbusiness/

Bitte beachten Sie auch:
http://www.website-design.at
http://www.arztsuche24.at
http://www.bauwohnwelt.at
http://www.immoversum.com
http://www.tupalo.com
http://www.urlauburlaub.at



Diese E-Mail kann vertrauliche und/oder rechtlich geschützte Informationen 
enthalten. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail 
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und 
vernichten Sie diese E-Mail. Das unerlaubte Kopieren sowie die unbefugte 
Weitergabe dieser Mail sind nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to