icinga-powershell-apichecks.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<#
.SYNOPSIS
   Registers an endpoint called 'checker' in our REST-Api
.DESCRIPTION
   This module will provide an endpoint for the Icinga for Windows REST-Api
   https://github.com/Icinga/icinga-powershell-restapi

   The endpoint itself is called 'checker' and will map available Cmdlets for
   check plugins
.FUNCTIONALITY
   This module will depend on the Icinga Plugins as well as the Framework and
   the REST-Api. It will provide a wrapper to execute Icinga Plugins over the
   REST-Api and fetch the plugin output
.OUTPUTS
   $NULL
.LINK
   https://github.com/Icinga/icinga-powershell-apichecks
.NOTES
#>

function Register-IcingaRESTAPIEndpointAPIChecks()
{
    return @{
        'Alias'   = 'checker';
        'Command' = 'Invoke-IcingaApiChecksRESTCall';
    };
}

<#
.SYNOPSIS
   Registers our command aliases for mapping the 'command' argument
   from our REST-Call securely to our PowerShell Cmdlets
.DESCRIPTION
   This module will provide an endpoint for the Icinga for Windows REST-Api
   https://github.com/Icinga/icinga-powershell-restapi
   By using the references, we can register endpoints and aliases to fetch
   informations
.EXAMPLE
   https://example.com/v1/checker?command=cpu
.FUNCTIONALITY
   This module will depend on the Icinga Plugins as well as the Framework and
   the REST-Api. It will provide a wrapper to execute Icinga Plugins over the
   REST-Api and fetch the plugin output
.OUTPUTS
   $NULL
.LINK
   https://github.com/Icinga/icinga-powershell-apichecks
.NOTES
#>

function Register-IcingaRESTApiCommandAliasesApiChecks()
{
    return @{
        'checker' = @{
            'bios'        = 'Invoke-IcingaCheckBiosSerial';
            'cpu'         = 'Invoke-IcingaCheckCPU';
            'checksum'    = 'Invoke-IcingaCheckSum';
            'dir'         = 'Invoke-IcingaCheckDirectory';
            'eventlog'    = 'Invoke-IcingaCheckEventlog';
            'firewall'    = 'Invoke-IcingaCheckFirewall';
            'memory'      = 'Invoke-IcingaCheckMemory';
            'nla'         = 'Invoke-IcingaCheckNLA';
            'perfcounter' = 'Invoke-IcingaCheckPerfcounter';
            'process'     = 'Invoke-IcingaCheckProcessCount';
            'service'     = 'Invoke-IcingaCheckService';
            'updates'     = 'Invoke-IcingaCheckUpdates';
            'uptime'      = 'Invoke-IcingaCheckUptime';
            'partition'   = 'Invoke-IcingaCheckUsedPartitionSpace';
            'user'        = 'Invoke-IcingaCheckUsers';
            'cert'        = 'Invoke-IcingaCheckCertificate';
        }
    }
}