I defined the "service account" as a global constant as you suggested by adding 
it to the constants.conf file in /etc/icinga2/

I created another file in /etc/icinga2/conf.d/ called windows_commands.conf and 
added the following:

object CheckCommand "check_wmi_plus" {
  import "plugin-check-command"

  command = PluginDir + "/check_wmi_plus.pl"

        arguments = {
    "-H" = "$address$"
    "-u" = "$wmi_plus_username$"
    "-p" = "$wmi_plus_password$"
    "-m" = "$check_mode$"
    "-w" = "$warning$"
    "-c" = "$critical$"
  }

  vars.wmi_plus_username = GlobalWmiPlusUser
  vars.wmi_plus_password = GlobalWmiPlusPassword

}

Then I created a server.conf file and a directory of the same server name. This 
conf is just for host-alive etc..


In the newly created directory I created another file called cpudetail.conf

object Service "wmi_plus_cpudetail" {
  import "generic-service"

  host_name = "servername"
  check_command = "check_wmi_plus"
  vars.sla = "24x7"
  vars.check_mode = "checkeachcpu"
  vars.cpu_warning = "85"
  vars.cpu_critical = "95"

}

After about 10 syntax errors on my part, I got it all sorted and now I get 
results and they are also showing up in graphite now. W00t

Status Information:     OK (Sample Period 60 sec) - CPU0=13.0% CPU1=13.6% 
CPU_Total=13.3%
Performance Data:       'Avg Utilisation CPU0'=13%;85;95 'Avg Utilisation 
CPU1'=13.6%;85;95 'Avg Utilisation CPU_Total'=13.300000000000001%;85;95

Now I will add the remaining arguments as variables to windows_commands.conf.

I still need to figure out some best practices moving forward. I need to learn 
more about the apply rules and templates etc... I also plan on trying to get 
HTML e-mail notifications going using existing nagios offering and changing 
them as needed.

-----Original Message-----
From: icinga-users [mailto:[email protected]] On Behalf Of 
Michael Friedrich
Sent: Monday, July 7, 2014 11:29 AM
To: [email protected]
Subject: Re: [icinga-users] Help with Icinga2 and check_wmi_plus

On 07.07.2014 17:25, [email protected] wrote:
> Victory is mine! It works!
>
> I don't know if I am doing it in the absolute best practice way but it seems 
> pretty clean.
>
> I am now able to pull wmi data from windows servers!

Would you mind posting your CheckCommand and send a patch upstream getting this 
thingy integrated?

>
> Thank you!
>
> -----Original Message-----
> From: icinga-users [mailto:[email protected]] On 
> Behalf Of Michael Friedrich
> Sent: Monday, July 7, 2014 10:04 AM
> To: [email protected]
> Subject: Re: [icinga-users] Help with Icinga2 and check_wmi_plus
>
> On 07.07.2014 15:58, [email protected] wrote:
>> By define it locally do you mean in /etc/icinga2/commands.conf for example? 
>> Or would I define the command in the host conf file?
> Wherever they fit for your understanding. Just make sure they are included 
> (I'd put them into conf.d/commands.conf being a lazy ass).
>
>> I'm struggling with understanding how commands are defined, sorry.
> That's why there's documentation.
> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2
> /latest/doc/module/icinga2/chapter/monitoring-basics#commands
>
>
>> I look at the default localhost.conf and the localhost directory full of 
>> various check services *.conf and I am having trouble understanding how the 
>> various commands are defined.
>>
>> If I look at 'disk' for example:
>>
>> object Service "disk" {
>>     import "generic-service"
>>
>>     host_name = "localhost"
>>     check_command = "disk"
>>     vars.sla = "24x7"
>> }
>>
>> The check_command = "disk".... where is the actual command for "disk" 
>> defined?
> By default in the Plugin Command Templates described in 
> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2
> /latest/doc/module/icinga2/chapter/configuring-icinga2#plugin-check-co
> mmand-disk
>
>> It looks like the only place it is defined is in 
>> /usr/share/icinga2/include/command-plugins.conf which is why I thought I 
>> needed to define commands in that file.
> Probably you should read this chapter as well.
> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2
> /latest/doc/module/icinga2/chapter/configuring-icinga2#plugin-check-co
> mmands
>
>> So if I create a conf file to use check_wmi_plus and define the check 
>> command like the mentioned below
>>
>> object CheckCommand "wmi_plus" {
>>      import ...
>>
>> How does it know where/what "wmi_plus" is? Or does it just look at 
>> /usr/lib/nagios/plugins for "wmi_plus" and then I define vars.whatever for 
>> all the arguments?
> Better explained here
> http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2
> /latest/doc/module/icinga2/chapter/monitoring-basics#command-plugin-in
> tegration
>
>
>> -----Original Message-----
>> From: icinga-users [mailto:[email protected]] On 
>> Behalf Of Michael Friedrich
>> Sent: Monday, July 7, 2014 9:08 AM
>> To: [email protected]
>> Subject: Re: [icinga-users] Help with Icinga2 and check_wmi_plus
>>
>> On 07.07.2014 14:41, [email protected] wrote:
>>> I’d like to use check_wmi_plus with Icinga2. I have check_wmi_plus 
>>> ready to go and all the configs are edited properly etc…
>>>
>>> I do have a couple of questions though.
>>>
>>> Do I need to define the commands in
>>> /usr/share/icinga2/include/command-plugins.conf?
>> No that file will be overridden on upgrade. Rather define it locally and 
>> submit a patch to upstream once capable for everyone.
>>
>>
>>> How do I define a username and password for the plugin to use? In 
>>> Nagios, I would add the username and password to the resources.conf 
>>> file and then reference them in the command as $ARG$ or something to 
>>> that effect. What is the equivalent of this in Icinga2?
>> One might define a global constant and use that in the check command 
>> definition. Something like
>>
>> const GlobalWmiPlusPassword = "foo"
>>
>> ...
>> object CheckCommand "wmi_plus" {
>>      import ...
>> ---
>>      vars.wmi_plus_username = GlobalWmiPlusPassword }
>>
>>
>>
>> --
>> Michael Friedrich, DI (FH)
>> Application Developer
>>
>> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
>> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
>> GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 
>> http://www.netways.de | [email protected]
>>
>> ** Open Source Backup Conference 2014 - September - osbconf.org **
>> ** Puppet Camp Duesseldorf 2014 - Oktober - netways.de/puppetcamp **
>> ** OSMC 2014 - November - netways.de/osmc **
>> ** OpenNebula Conf 2014 - Dezember - opennebulaconf.com ** 
>> _______________________________________________
>> icinga-users mailing list
>> [email protected]
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>> _______________________________________________
>> icinga-users mailing list
>> [email protected]
>> https://lists.icinga.org/mailman/listinfo/icinga-users
>
> --
> Michael Friedrich, DI (FH)
> Application Developer
>
> NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
> Tel: +49 911 92885-0 | Fax: +49 911 92885-77
> GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 
> http://www.netways.de | [email protected]
>
> ** Open Source Backup Conference 2014 - September - osbconf.org **
> ** Puppet Camp Duesseldorf 2014 - Oktober - netways.de/puppetcamp **
> ** OSMC 2014 - November - netways.de/osmc **
> ** OpenNebula Conf 2014 - Dezember - opennebulaconf.com ** 
> _______________________________________________
> icinga-users mailing list
> [email protected]
> https://lists.icinga.org/mailman/listinfo/icinga-users
> _______________________________________________
> icinga-users mailing list
> [email protected]
> https://lists.icinga.org/mailman/listinfo/icinga-users


--
Michael Friedrich, DI (FH)
Application Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461 http://www.netways.de | 
[email protected]

** Open Source Backup Conference 2014 - September - osbconf.org **
** Puppet Camp Duesseldorf 2014 - Oktober - netways.de/puppetcamp **
** OSMC 2014 - November - netways.de/osmc **
** OpenNebula Conf 2014 - Dezember - opennebulaconf.com ** 
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to