< Back

Get-ZabbixEvent

Sun Jan 19, 2020 6:10 pm

NAME Get-ZabbixEvent



SYNOPSIS

Get events





SYNTAX

Get-ZabbixEvent [[-TimeFrom] <Object>] [[-TimeTill] <Object>] [[-HostID] <Object>] [[-EventID] <Array>] [[-SortBy]

<Array>] [[-source] <Object>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL] <String>]

[<CommonParameters>]





DESCRIPTION





PARAMETERS

-TimeFrom <Object>

epoch time



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TimeTill <Object>

epoch time

Time until to display alerts. Default: till now. Time is in UTC/GMT



Required? false

Position? 2

Default value (convertTo-epoch ((get-date).addhours(0)).ToUniversalTime())

Accept pipeline input? false

Accept wildcard characters? false



-HostID <Object>



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-EventID <Array>



Required? false

Position? 4

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-SortBy <Array>



Required? false

Position? 5

Default value clock

Accept pipeline input? false

Accept wildcard characters? false



-source <Object>

Possible values for trigger events: 0 - trigger; 1 - discovered host; 2 - discovered service; 3 -

auto-registered host



Required? false

Position? 6

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 7

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? 8

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? 9

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? 10

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-ZabbixEvent -EventID 445750



Get Event









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-ZabbixEvent -TimeFrom (convertTo-epoch (get-date).addhours(-24)) | select @{n="Time

UTC";e={convertfrom-epoch $_.clock}},@{n="Server";e={$_.hosts.name}},@{n="alerts";e={$_.alerts.subject[0]}}



Get events for last 24 hours. According UTC/GMT+0 time. TimeTill is now in UTC/GMT+0 time









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-ZabbixProblem | Get-ZabbixEvent | ft -a



Get events









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Get-ZabbixProblem | Get-ZabbixEvent | select @{n="clock(UTC+1)";e={(convertfrom-epoch

$_.clock).addhours(1)}},* | ft -a



Get events. Time in UTC+1









-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Get-ZabbixEvent -TimeFrom (convertTo-epoch (get-date).addhours(-24)) -TimeTill (convertTo-epoch

(get-date).addhours(0)) | select @{n="Time UTC";e={convertfrom-epoch

$_.clock}},@{n="Server";e={$_.hosts.name}},@{n="alerts";e={$_.alerts.subject[0]}}



Get events for last 24 hours









-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Get-ZabbixEvent -TimeFrom (convertTo-epoch (get-date).addhours(-24*25)) -TimeTill (convertTo-epoch

(get-date).addhours(0)) | ? alerts | ? {$_.hosts.name -match "webserver" } | select @{n="Time

UTC";e={convertfrom-epoch $_.clock}},@{n="Server";e={$_.hosts.name}},@{n="alerts";e={$_.alerts.subject[0]}}



Get events for last 25 days for servers with name match webserver









-------------------------- EXAMPLE 7 --------------------------



PS C:\\>Get-ZabbixEvent -TimeFrom (convertTo-epoch (get-date).addhours(-5)) -TimeTill (convertTo-epoch

(get-date).addhours(0)) | ? alerts | ? {$_.hosts.name -match "DB" } | select eventid,@{n="Time

UTC+2";e={(convertfrom-epoch

$_.clock).addhours(1)}},@{n="Server";e={$_.hosts.name}},@{n="alerts";e={$_.alerts.subject[0]}} | ft -a



Get events from 5 days ago for servers with name match "DB", and display time in UTC+1









-------------------------- EXAMPLE 8 --------------------------



PS C:\\>Get-ZabbixEvent -TimeFrom (convertTo-epoch (get-date).AddDays(-180)) -TimeTill (convertTo-epoch

(get-date).AddDays(-150)) | ? alerts | ? {$_.hosts.name -match "host" } | select @{n="Time

UTC";e={convertfrom-epoch $_.clock}},@{n="Server";e={$_.hosts.name}},@{n="alerts";e={$_.alerts.subject[0]}}



Get past (180-150 days ago) events for host











RELATED LINKS