Skip to content

Commit

Permalink
Fix accessing to undefined command & argument vars
Browse files Browse the repository at this point in the history
Although in the command.conf file almost all arguments have been defined with $powershell_*$,
but in the example.conf file the arguments and commands are accessed with vars.winrm_*, which do not exist.
  • Loading branch information
yhabteab committed Sep 25, 2020
1 parent 4580086 commit 94cd86e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion icinga2/command.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
object CheckCommand "winrm" {
object CheckCommand "powershell" {
command = [ PluginDir + "/check_by_powershell" ]

arguments = {
Expand Down
16 changes: 8 additions & 8 deletions icinga2/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ object Host "windowshost" {
import "generic-host"

address = "192.168.172.217"
vars.winrm_port = 5985
vars.winrm_user = "windowsuser"
vars.winrm_password = "secret!pw"
// vars.winrm_insecure = true
vars.powershell_port = 5985
vars.powershell_user = "windowsuser"
vars.powershell_password = "secret!pw"
// vars.powershell_insecure = true

vars.server_type = "windows"
}
Expand All @@ -14,13 +14,13 @@ template Service "powershell-template-service" {
import "generic-service"

vars.original_check_command = check_command
check_command = "winrm"
check_command = "powershell"

vars.by_winrm_command = {{ get_check_command(service.vars.original_check_command).command }}
vars.by_winrm_arguments = {{ get_check_command(service.vars.original_check_command).arguments }}
vars.by_powershell_command = {{ get_check_command(service.vars.original_check_command).command }}
vars.by_powershell_arguments = {{ get_check_command(service.vars.original_check_command).arguments }}
}

apply Service "winrm_check_ntp" {
apply Service "powershell_check_ntp" {
check_command = "powershell-checkTime-sync"

import "powershell-template-service"
Expand Down

0 comments on commit 94cd86e

Please sign in to comment.