mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
Added basic documentation for Check-Commands
This commit is contained in:
parent
4e6917e954
commit
191a132024
2 changed files with 75 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ To validate if the module is installed properly, you can start a new PowerShell
|
|||
|
||||
```powershell
|
||||
Get-Module -ListAvailable -Name icinga-module-windows
|
||||
```
|
||||
```
|
||||
|
||||
If you receive an output stating that the module is installed, you are fine to continue.
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ This will create the base configuration of the module including the setup of dir
|
|||
Once completed successfully, you are ready to get started with using it. This will include
|
||||
|
||||
* Using it localy with scripts
|
||||
* Integrate it with the Icinga 2 Agent
|
||||
* Integration into for the Icinga 2 Agent
|
||||
* Use it as Remote Execution target
|
||||
* Integrate it into Icinga Web 2
|
||||
|
||||
|
|
@ -61,5 +61,6 @@ Of course if you wish to actively send data to Icinga Web 2 for example, you can
|
|||
|
||||
For additional setup possibilities, please take a look on the following pages:
|
||||
|
||||
* [Use the module as Icinga Plugin Framework](12-Icinga2AgentExample.md)
|
||||
* [Install the module as Windows Service](10-InstallService.md)
|
||||
* [Integration into Icinga Web 2](11-IcingaWeb2Integration.md)
|
||||
* [Integration into Icinga Web 2](11-IcingaWeb2Integration.md)
|
||||
|
|
|
|||
71
doc/12-Icinga2AgentExample.md
Normal file
71
doc/12-Icinga2AgentExample.md
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
Icinga Agent integration as Framework Modules
|
||||
=====================================
|
||||
|
||||
This PowerShell modules provides a wide range of Check-Plugins for Icinga 2 to fetch information from a Windows system. Once the module is installed, the Plugins are ready to use.
|
||||
|
||||
Requirements
|
||||
--------------
|
||||
|
||||
To properly work we recommend using the Icinga 2 Agent.
|
||||
|
||||
Usage of the Check-Commands
|
||||
--------------
|
||||
|
||||
Each call from the Icinga 2 Agent requires a short initialisation of the module. This can either be done by using the `Import-Module` Cmdlet in case the module is not autoloaded, or by calling
|
||||
|
||||
```powershell
|
||||
Use-Icinga;
|
||||
```
|
||||
|
||||
before each function call. An example on the PowerShell would be this:
|
||||
|
||||
```
|
||||
Use-Icinga; Invoke-IcingaCheckCPU;
|
||||
```
|
||||
|
||||
This will initialise the module and execute the Check-Command afterwards.
|
||||
|
||||
Check-Command definition for Icinga
|
||||
--------------
|
||||
|
||||
A example Check-Command for Icinga could look like this:
|
||||
|
||||
```
|
||||
object CheckCommand "Windows Check CPU" {
|
||||
import "plugin-check-command"
|
||||
command = [
|
||||
"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
|
||||
]
|
||||
timeout = 3m
|
||||
arguments += {
|
||||
"-C" = {
|
||||
order = 0
|
||||
value = "Use-Icinga; exit Invoke-IcingaCheckCPU"
|
||||
}
|
||||
"-Critical" = {
|
||||
order = 2
|
||||
value = "$PowerShell_Critical$"
|
||||
}
|
||||
"-NoPerfData" = {
|
||||
order = 6
|
||||
set_if = "$PowerShell_NoPerfData$"
|
||||
}
|
||||
"-Verbose" = {
|
||||
order = 4
|
||||
value = "$PowerShell_Verbose$"
|
||||
}
|
||||
"-Warning" = {
|
||||
order = 1
|
||||
value = "$PowerShell_Warning$"
|
||||
}
|
||||
}
|
||||
vars.PowerShell_Critical = "$$null"
|
||||
vars.PowerShell_NoPerfData = "0"
|
||||
vars.PowerShell_Verbose = "0"
|
||||
vars.PowerShell_Warning = "$$null"
|
||||
}
|
||||
```
|
||||
|
||||
This will call the PowerShell, execute the provided initialisation function `Use-Icinga` and afterwards execute the Check-Plugin with the provided arguments.
|
||||
|
||||
Unlike other PowerShell integrations, it will automaticly exit with the proper exit code - no special handling is required here.
|
||||
Loading…
Reference in a new issue