# Windows Agent - Implement new Check Command

**URL:** <https://community.icinga.com/t/windows-agent-implement-new-check-command/9542>\
**Category:** Icinga Director\
**Tags:** api, director, icinga2\
**Created:** [March 30, 2022, 5:42pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542 "2022-03-30T17:42:41Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [March 30, 2022, 5:42pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/1 "2022-03-30T17:42:41Z")

</div>

Hey everyone,

i would upgrade my Windows Monitoring Infrastructur, with some special Check Commands.  
For this, I created a folder in the path where /etc and /var are, where I copied all the checks.

How do you solve this in your monitoring structure? Unfortunately, the checks are not recognised. Icinga report ,Check-name not exist"

I have added the following lines to Constans.conf:

const CustomPluginDir = PluginDir //PrefixDir + “/monitoring/checks”  
const PluginContribDir = PluginDir //PrefixDir + “/monitoring/checks”

Maybe you have some good advice or tips for me.

const CustomPluginDir = PluginDir //PrefixDir + “/monitoring/checks”  
const PluginContribDir = PluginDir //PrefixDir + “/monitoring/checks”

Maybe you have some good advice or tips for me. 🙂

---

<div class="post-metadata">

**Author:** ![stevie-sy](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@stevie-sy](https://community.icinga.com/u/stevie-sy)\
**Post date:** [March 31, 2022, 6:54am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/2 "2022-03-31T06:54:12Z")

</div>

Hi,

just a shoot in the dark: is `PrefixDir` defined? As well did you tried `PluginDir + "/" + PrefixDir + “/monitoring/checks”`

---

<div class="post-metadata">

**Author:** ![rsx](https://community.icinga.com/user_avatar/community.icinga.com/rsx/32/2094_2.png) [@rsx](https://community.icinga.com/u/rsx)\
**Post date:** [March 31, 2022, 7:21am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/3 "2022-03-31T07:21:49Z")

</div>

You need to define check commands on the icinga machine as well as every Windows machine. The simplest way to do this is to put those objects into a global group that is defined at every machine.

---

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [March 31, 2022, 5:45pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/4 "2022-03-31T17:45:17Z")

</div>

Hi Roland,

I have already stored this in my service templates on my master. There, the plug-in directory is specified as /monitoring/checks. I think this is an error in my logic with the agent configuration on the windows host. How did you solve this in your infrastructure or do you happen to have an idea how I can check what is missing at best 🙂

---

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [March 31, 2022, 5:46pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/5 "2022-03-31T17:46:17Z")

</div>

unfortunately no. I’m afraid I’ve forgotten something in the agent, but unfortunately I can’t find it. Or I cannot explain why the query does not take place.

---

<div class="post-metadata">

**Author:** ![rsx](https://community.icinga.com/user_avatar/community.icinga.com/rsx/32/2094_2.png) [@rsx](https://community.icinga.com/u/rsx)\
**Post date:** [April 1, 2022, 7:02am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/6 "2022-04-01T07:02:07Z")

</div>

We’ve created a global zone `windows-commands` and placed all Windows command objects in it.

You can check if a object is existing with `icinga2 object list -n <name>`

---

<div class="post-metadata">

**Author:** ![stevie-sy](https://community.icinga.com/letter_avatar_proxy/v4/letter/s/898d66/32.png) [@stevie-sy](https://community.icinga.com/u/stevie-sy)\
**Post date:** [April 1, 2022, 7:35am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/7 "2022-04-01T07:35:34Z")

</div>

Don’t forget, that it’s not a “must” to use the constant `PluginDir`. You can also write full path names.

We are doing this for self written scripts. Especially if the the person who responsible for the server write his own special check script. He is telling us the path and we create the check command and service check in the director. If this person is doing this, he is also responsible to backup his check. Anway - in case of powershell checks - we offer the person every time, to put these checks into our own powershell module 😉

---

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [April 7, 2022, 10:37am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/8 "2022-04-07T10:37:11Z")

</div>

Hi @stevie-sy, hi @rsx ,

Here’s what I found out about the zone. The \_etc folder is empty in the agent. What do I have to do now? 🙂

![image](https://community.icinga.com/uploads/default/original/2X/1/1acef7b07c050a435c2827179bcc2ecbf71f336c.png)

---

<div class="post-metadata">

**Author:** ![rsx](https://community.icinga.com/user_avatar/community.icinga.com/rsx/32/2094_2.png) [@rsx](https://community.icinga.com/u/rsx)\
**Post date:** [April 7, 2022, 11:09am UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/9 "2022-04-07T11:09:35Z")

</div>

Check if the global zone is configured at your Windows machines and then do a restart of the icinga agent. Check `icinga.log` at the Windows machine(s) for any errors or other hints.

---

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [April 7, 2022, 1:15pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/10 "2022-04-07T13:15:21Z")

</div>

Here is my zone configuration. Unfortunately I have not found any logs. I restarted the agent service, it came back without problems.

```auto
object Endpoint "TEST" {
}

object Endpoint "monitoring.server.de" {
}

object Zone "master" {
    endpoints = ["monitoring.server.de"];
}

object Zone "TEST" {
    parent = "master";
    endpoints = ["TEST"];
}

object Zone "global-templates" {
    global = true;
}

object Zone "windows-templates" {
    global = true;
}

```

---

<div class="post-metadata">

**Author:** ![rsx](https://community.icinga.com/user_avatar/community.icinga.com/rsx/32/2094_2.png) [@rsx](https://community.icinga.com/u/rsx)\
**Post date:** [April 7, 2022, 1:21pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/11 "2022-04-07T13:21:31Z")

</div>

You have no connection information in this `zones.conf`, hence, the agent will not initate a connection to its master. If you have your master configured not to connect to agents, than you will have no connection at all. Hence, nothing to sync.

---

<div class="post-metadata">

**Author:** ![ShowMeYourSkil](https://community.icinga.com/user_avatar/community.icinga.com/showmeyourskil/32/4975_2.png) [@ShowMeYourSkil](https://community.icinga.com/u/ShowMeYourSkil)\
**Post date:** [April 7, 2022, 1:39pm UTC](https://community.icinga.com/t/windows-agent-implement-new-check-command/9542/12 "2022-04-07T13:39:54Z")

</div>

Thanks for your tip now it works. I have done the installation as follows:

With Powershell:

```auto
Start-IcingaAgentInstallWizard `
>> -DirectorUrl 'https://172.16.100.84/icingaweb2/director/' `
>> -SelfServiceAPIKey '6c638180883357eee112871f605cc41b8481452b'`
>> -UseDirectorSelfService 1 `
>> -OverrideDirectorVars 0 `
>> -Reconfigure `
>> -RunInstaller

```

I thought it configures the zone automatically?
