< Back
Get-ZabbixAlert
Post
NAME Get-ZabbixAlert
SYNOPSIS
Get alerts
SYNTAX
Get-ZabbixAlert [[-HostID] <Array>] [[-TimeFrom] <Object>] [[-TimeTill] <Object>] [[-SortBy] <Array>] [[-jsonrpc]
<String>] [[-session] <String>] [[-id] <String>] [[-URL] <String>] [<CommonParameters>]
DESCRIPTION
PARAMETERS
-HostID <Array>
HostID
Required? false
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-TimeFrom <Object>
epoch time
TimeFrom to display the alerts. Default: -5, from five hours ago. Time is in UTC/GMT"
Required? false
Position? 2
Default value (convertTo-epoch ((get-date).addhours(-5)).ToUniversalTime())
Accept pipeline input? false
Accept wildcard characters? false
-TimeTill <Object>
epoch time
TimeTill to display the alerts. Default: till now. Time is in UTC/GMT"
Required? false
Position? 3
Default value (convertTo-epoch ((get-date).addhours(0)).ToUniversalTime())
Accept pipeline input? false
Accept wildcard characters? false
-SortBy <Array>
Required? false
Position? 4
Default value clock
Accept pipeline input? false
Accept wildcard characters? false
-jsonrpc <String>
Required? false
Position? 5
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-session <String>
Required? false
Position? 6
Default value ($global:zabSessionParams.session)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-id <String>
Required? false
Position? 7
Default value ($global:zabSessionParams.id)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-URL <String>
Required? false
Position? 8
Default value ($global:zabSessionParams.url)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC)";e={convertfrom-epoch
$_.clock}},alertid,sendto,subject
Get alerts from last 5 hours (default). Time display in UTC/GMT (default)
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC+1)";e={(convertfrom-epoch
$_.clock).addhours(+1)}},alertid,subject
Get alerts from last 5 hours (default). Time display in UTC+1
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC-5)";e={(convertfrom-epoch
$_.clock).addhours(-5)}},alertid,subject
Get alerts from last 5 hours (default). Time display in UTC-5
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | ? subject -match OK | select @{n="Time(UTC)";e={convertfrom-epoch
$_.clock}},alertid,sendto,subject
Get alerts with OK status
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch (((get-date).ToUniversalTime()).addhours(-10))) -TimeTill
(convertTo-epoch (((get-date).ToUniversalTime()).addhours(-2))) | ? sendto -match mail | ? subject -match "" |
select @{n="Time(UTC)";e={convertfrom-epoch $_.clock}},alertid,sendto,subject
Get alerts within custom timewindow of 8 hours (-timeFrom, -timeTill in UTC/GMT). Time display in UTC/GMT (default)
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch (((get-date).ToUniversalTime()).addhours(-5))) -TimeTill
(convertTo-epoch ((get-date).ToUniversalTime()).addhours(0)) | ? sendto -match mail | select @{n="Time
UTC";e={convertfrom-epoch $_.clock}},alertid,sendto,subject
Get alerts for last 5 hours
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match "hosts" | Get-ZabbixAlert | ? sendto -match mail | select
@{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Get alerts for hosts from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>Get-ZabbixHost -HostName "Server-01" | Get-ZabbixAlert -ea silent | ? sendto -match email | select
@{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Works for single host (name case sensitive). Get alerts for host from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 9 --------------------------
PS C:\\>Get-ZabbixAlert -HostID (Get-ZabbixHost | ? name -match "Host|OtherHost").hostid | ? sendto -match email |
select @{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Works for multiple hosts. Get alerts for hosts from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 10 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch ((get-date -date "05/25/2015
9:00").ToUniversalTime()).addhours(0)) -TimeTill (convertTo-epoch ((get-date -date "05/25/2015
14:00").ToUniversalTime()).addhours(0)) | ? sendto -match mail | select @{n="Time(UTC)";e={(convertfrom-epoch
$_.clock).addhours(0)}},alertid,subject
Get alerts between two dates (in UTC), present time in UTC
RELATED LINKS
SYNOPSIS
Get alerts
SYNTAX
Get-ZabbixAlert [[-HostID] <Array>] [[-TimeFrom] <Object>] [[-TimeTill] <Object>] [[-SortBy] <Array>] [[-jsonrpc]
<String>] [[-session] <String>] [[-id] <String>] [[-URL] <String>] [<CommonParameters>]
DESCRIPTION
PARAMETERS
-HostID <Array>
HostID
Required? false
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-TimeFrom <Object>
epoch time
TimeFrom to display the alerts. Default: -5, from five hours ago. Time is in UTC/GMT"
Required? false
Position? 2
Default value (convertTo-epoch ((get-date).addhours(-5)).ToUniversalTime())
Accept pipeline input? false
Accept wildcard characters? false
-TimeTill <Object>
epoch time
TimeTill to display the alerts. Default: till now. Time is in UTC/GMT"
Required? false
Position? 3
Default value (convertTo-epoch ((get-date).addhours(0)).ToUniversalTime())
Accept pipeline input? false
Accept wildcard characters? false
-SortBy <Array>
Required? false
Position? 4
Default value clock
Accept pipeline input? false
Accept wildcard characters? false
-jsonrpc <String>
Required? false
Position? 5
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-session <String>
Required? false
Position? 6
Default value ($global:zabSessionParams.session)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-id <String>
Required? false
Position? 7
Default value ($global:zabSessionParams.id)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-URL <String>
Required? false
Position? 8
Default value ($global:zabSessionParams.url)
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC)";e={convertfrom-epoch
$_.clock}},alertid,sendto,subject
Get alerts from last 5 hours (default). Time display in UTC/GMT (default)
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC+1)";e={(convertfrom-epoch
$_.clock).addhours(+1)}},alertid,subject
Get alerts from last 5 hours (default). Time display in UTC+1
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | select @{n="Time(UTC-5)";e={(convertfrom-epoch
$_.clock).addhours(-5)}},alertid,subject
Get alerts from last 5 hours (default). Time display in UTC-5
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-ZabbixAlert | ? sendto -match email | ? subject -match OK | select @{n="Time(UTC)";e={convertfrom-epoch
$_.clock}},alertid,sendto,subject
Get alerts with OK status
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch (((get-date).ToUniversalTime()).addhours(-10))) -TimeTill
(convertTo-epoch (((get-date).ToUniversalTime()).addhours(-2))) | ? sendto -match mail | ? subject -match "" |
select @{n="Time(UTC)";e={convertfrom-epoch $_.clock}},alertid,sendto,subject
Get alerts within custom timewindow of 8 hours (-timeFrom, -timeTill in UTC/GMT). Time display in UTC/GMT (default)
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch (((get-date).ToUniversalTime()).addhours(-5))) -TimeTill
(convertTo-epoch ((get-date).ToUniversalTime()).addhours(0)) | ? sendto -match mail | select @{n="Time
UTC";e={convertfrom-epoch $_.clock}},alertid,sendto,subject
Get alerts for last 5 hours
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match "hosts" | Get-ZabbixAlert | ? sendto -match mail | select
@{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Get alerts for hosts from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>Get-ZabbixHost -HostName "Server-01" | Get-ZabbixAlert -ea silent | ? sendto -match email | select
@{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Works for single host (name case sensitive). Get alerts for host from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 9 --------------------------
PS C:\\>Get-ZabbixAlert -HostID (Get-ZabbixHost | ? name -match "Host|OtherHost").hostid | ? sendto -match email |
select @{n="Time(UTC-5)";e={(convertfrom-epoch $_.clock).addhours(-5)}},alertid,subject
Works for multiple hosts. Get alerts for hosts from last 5 hours (default). Display time in UTC-5
-------------------------- EXAMPLE 10 --------------------------
PS C:\\>Get-ZabbixAlert -TimeFrom (convertTo-epoch ((get-date -date "05/25/2015
9:00").ToUniversalTime()).addhours(0)) -TimeTill (convertTo-epoch ((get-date -date "05/25/2015
14:00").ToUniversalTime()).addhours(0)) | ? sendto -match mail | select @{n="Time(UTC)";e={(convertfrom-epoch
$_.clock).addhours(0)}},alertid,subject
Get alerts between two dates (in UTC), present time in UTC
RELATED LINKS