Skip to content

Commit

Permalink
Names are sound and smoke
Browse files Browse the repository at this point in the history
Let's use check_by_powershell

fixes #4
  • Loading branch information
lazyfrosch committed Sep 11, 2020
1 parent 594b91f commit 294b24e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v1.0.0
with:
name: check_by_winrm-go${{ matrix.go }}
name: check_by_powershell-go${{ matrix.go }}
path: build
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GIT_COMMIT := $(shell git rev-list -1 HEAD)
GO_BUILD := go build -v -ldflags "-X main.GitCommit=$(GIT_COMMIT)"

NAME = check_by_winrm
NAME = check_by_powershell

.PHONY: all clean build test

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# check_by_winrm
# check_by_powershell

<!-- NOTE: Update this description also in main.go -->

Icinga check plugin to run checks and other commands directly on any Windows system using WinRM (Windows Remote Management).
Icinga check plugin to run checks and other commands directly on any Windows system using
WinRM (Windows Remote Management) and Powershell.

Main use case would be to call one of the [plugins](https://github.com/Icinga/icinga-powershell-plugins)
from the [Icinga Powershell Framework](https://github.com/Icinga/icinga-powershell-framework). This will avoid the
Expand Down Expand Up @@ -50,7 +51,7 @@ Also, see the Icinga 2 examples in the [icinga2/ directory](icinga2/).

Calling a PowerShell plugin from the framework is easy:

./check_by_winrm -H example.local.de --user 'ad\user' --password '!secret!pw' \
./check_by_powershell -H example.local.de --user 'ad\user' --password '!secret!pw' \
--icingacmd 'Invoke-IcingaCheckCPU -Warning 80 -Critical 90'

[OK] Check package "CPU Load"
Expand All @@ -63,7 +64,7 @@ Notes:

Executing any other Windows program or script, could be another Icinga plugin:

./check_by_winrm -H 192.168.172.217 \
./check_by_powershell -H 192.168.172.217 \
--user 'windowsuser' --password 'secret!pw' \
--cmd "cscript.exe /T:30 /NoLogo C:\Windows\system32\check_time.vbs 1.de.pool.ntp.org 20 240"

Expand Down Expand Up @@ -156,8 +157,8 @@ The plugin is written in Golang and can easily be compiled from source, see the
for further details.

```
GOOS=linux GOARCH=amd64 go build -o check_by_winrm .
GOOS=windows GOARCH=amd64 go build -o check_by_winrm.exe .
GOOS=linux GOARCH=amd64 go build -o check_by_powershell .
GOOS=windows GOARCH=amd64 go build -o check_by_powershell.exe .
```

## Acknowledgements
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/Icinga/check_by_winrm
module github.com/Icinga/check_by_powershell

go 1.14

Expand Down
32 changes: 16 additions & 16 deletions icinga2/command.conf
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
object CheckCommand "winrm" {
command = [ PluginDir + "/check_by_winrm" ]
command = [ PluginDir + "/check_by_powershell" ]

arguments = {
"-H" = {
value = "$address$"
description = "Host name, IP Address of the remote host"
}
"-p" = {
value = "$winrm_port$"
value = "$powershell_port$"
description = "Port number WinRM"
}
"--user" = {
value = "$winrm_user$"
value = "$powershell_user$"
description = "Username of the remote host"
}
"--password" = {
value = "$winrm_password$"
value = "$powershell_password$"
description = "Password of the user"
}
"--no-tls" = {
value = "$winrm_no_tls$"
value = "$powershell_no_tls$"
description = "Don't use a TLS connection"
}
"--insecure" = {
value = "$winrm_insecure$"
value = "$powershell_insecure$"
description = "Verify the hostname on the returned certificate"
}
"--ca" = {
value = "$winrm_ca$"
value = "$powershell_ca$"
description = "CA certificate"
}
"--cert" = {
value = "$winrm_cert$"
value = "$powershell_cert$"
description = "Client certificate"
}
"--key" = {
value = "$winrm_key$"
value = "$powershell_key$"
description = "Client key"
}
"--icingacmd" = {{
var command = macro("$by_winrm_command$")
var arguments = macro("$by_winrm_arguments$")
var command = macro("$by_powershell_command$")
var arguments = macro("$by_powershell_arguments$")
if (typeof(command) == String && !arguments) {
return command
}
Expand All @@ -53,23 +53,23 @@ object CheckCommand "winrm" {
description = "Executes commands of Icinga PowerShell Framework"
}}
"--cmd" = {
value = "$winrm_cmd$"
value = "$powershell_cmd$"
description = "Command to execute on the remote machine"
}
"--auth" = {
value = "$winrm_auth$"
value = "$powershell_auth$"
description = "Authentication mechanism - NTLM | SSH"
}
"--sshhost" = {
value = "$winrm_sshhost$"
value = "$powershell_sshhost$"
description = "SSH Host"
}
"--sshuser" = {
value = "$winrm_sshuser$"
value = "$powershell_sshuser$"
description = "SSH Username"
}
"--sshpassword" = {
value = "$winrm_sshpassword$"
value = "$powershell_sshpassword$"
description = "SSH Password"
}
}
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

const readme = `Icinga check plugin to run checks and other commands directly on
any Windows system using WinRM (Windows Remote Management)
any Windows system using WinRM (Windows Remote Management) and Powershell
Main use case would be to call one of the plugins from the Icinga Powershell Framework.
This will avoid the requirement of installing an Icinga 2 agent on every Windows system.
Expand All @@ -21,7 +21,7 @@ Supported authentication methods:
* NTLM with local or AD accounts
* TLS client certificate
https://github.com/Icinga/check_by_winrm
https://github.com/Icinga/check_by_powershell
https://github.com/Icinga/icinga-powershell-framework
https://github.com/Icinga/icinga-powershell-plugins
Expand All @@ -46,7 +46,7 @@ func main() {

plugin := check.NewConfig()

plugin.Name = "check_by_winrm"
plugin.Name = "check_by_powershell"
plugin.Readme = readme
plugin.Version = buildVersion()
plugin.Timeout = 10
Expand Down

0 comments on commit 294b24e

Please sign in to comment.