< Back

Get-ZabbixItem

Sun Jan 19, 2020 6:11 pm

NAME Get-ZabbixItem



SYNOPSIS

Retrieve items





SYNTAX

Get-ZabbixItem [-SortBy <String>] [-ItemKey <String>] [-ItemName <String>] [-Description <String>] [-WebItems]

[-jsonrpc <String>] [-session <String>] [-id <String>] [-URL <String>] [<CommonParameters>]



Get-ZabbixItem [-SortBy <String>] [-ItemKey <String>] [-ItemName <String>] [-Description <String>] [-HostName

<String>] [-WebItems] [-jsonrpc <String>] [-session <String>] [-id <String>] [-URL <String>] [<CommonParameters>]



Get-ZabbixItem [-SortBy <String>] [-ItemKey <String>] [-ItemName <String>] [-Description <String>] [-HostId

<Array>] [-TemplateID <Array>] [-TriggerID <Array>] [-WebItems] [-jsonrpc <String>] [-session <String>] [-id

<String>] [-URL <String>] [<CommonParameters>]





DESCRIPTION

Retrieve items





PARAMETERS

-SortBy <String>



Required? false

Position? named

Default value name

Accept pipeline input? false

Accept wildcard characters? false



-ItemKey <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ItemName <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HostName <String>



Required? false

Position? named

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostId <Array>



Required? false

Position? named

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TemplateID <Array>



Required? false

Position? named

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TriggerID <Array>



Required? false

Position? named

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-WebItems [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? named

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? named

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? named

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? named

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-ZabbixItem -HostId (Get-ZabbixHost | ? name -match hostName).hostid | select name,key_,lastvalue



Get Items for host (case insensitive)









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



PS C:\\>Get-ZabbixItem -ItemName 'RAM Utilization (%)' -HostId (Get-ZabbixHost | ? name -match "dc1").hostid |

select @{n="hostname";e={$_.hosts.name}},name,key_,@{n="Time(UTC+1)";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},status,prevvalue,@{n="lastvalue";e={[decimal][math]::Round($_.lastvalue,3)}} | sort

lastvalue -desc | ft -a



Get Items with name 'RAM Utilization (%)' for hosts by match









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



PS C:\\>Get-ZabbixHost | ? name -match "Hosts" | Get-ZabbixItem -ItemName 'RAM Utilization (%)' | select

@{n="hostname";e={$_.hosts.name}},name,key_,@{n="Time(UTC+1)";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},status,prevvalue,@{n="lastvalue";e={[decimal][math]::Round($_.lastvalue,3)}} | sort

lastvalue -desc | ft -a



Get Items with name 'RAM Utilization (%)' for hosts by match, same as above









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



PS C:\\>Get-ZabbixItem -ItemName 'Memory Total' -HostId (Get-ZabbixHost | ? name -match "").hostid | select

@{n="hostname";e={$_.hosts.name}},name,key_,@{n="Time(UTC+1)";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},prevvalue,@{n="lastvalue";e={[decimal][math]::round(($_.lastvalue/1gb),2)}} | sort

lastvalue -desc | ft -a



Get Items with name 'Memory Total' for hosts by match









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



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -NotMatch host | ? name -match host).hostid | ? key_ -match

"Processor time" | ? key_ -notmatch "vmver" | select @{n="lastclock";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n='CPU%';e={[int]$_.lastvalue}},name,key_ | sort

'CPU%' -desc | ft -a



Get hosts' CPU utilization









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



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match host).hostid | ? key_ -match

"/mnt/reporter_files,[used,free]" | ? lastvalue -ne 0 | select @{n="Time(UTC+1)";e={(convertfrom-epoch $_.lastclock

).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n="lastvalue";e={[decimal][math]::round(($_.lastvalue/1gb),2)}},ke

y_,description | sort host | ft -a



Get Items for host(s) with key_ match









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



PS C:\\>Get-ZabbixItem -TemplateID (Get-ZabbixTemplate | ? name -match "myTemplates").templateid | ? history -ne 7

| select @{n="Template";e={$_.hosts.name}},history,name -Unique | sort Template



Get Items for templates, where history not 7 days









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



PS C:\\>Get-ZabbixTemplate | ? name -match "myTemplates" | Get-ZabbixItem | select

@{n="Template";e={$_.hosts.name}},key_ -Unique | sort Template



Get item keys for templates









-------------------------- EXAMPLE 9 --------------------------



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match hostName).hostid | ? key_ -match

"Version|ProductName" | ? key_ -notmatch "vmver" | select @{n="Time(UTC+1)";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},lastvalue,name,key_ | sort host,key_ | ft -a



Get Items by host match, by key_ match/notmatch









-------------------------- EXAMPLE 10 --------------------------



PS C:\\>Get-ZabbixHost -hostname hostName | Get-ZabbixItem -SortBy status -ItemKey pfree | select name,

key_,@{n="Time(UTC)";e={convertfrom-epoch $_.lastclock}},lastvalue,status | ft -a



Get Items (disk usage(%) information) for single host









-------------------------- EXAMPLE 11 --------------------------



PS C:\\>Get-ZabbixHost | ? name -match "hosts" | Get-ZabbixItem -ItemName 'RAM Utilization (%)' | select

@{n="hostname";e={$_.hosts.name}},name,key_,@{n="Time(UTC+1)";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},prevvalue,lastvalue | sort hostname | ft -a



Get Items for multiple hosts by match









-------------------------- EXAMPLE 12 --------------------------



PS C:\\>Get-ZabbixHost | ? name -match "host|host" | Get-ZabbixItem | ? key_ -match HeapMemoryUsage.used | select

@{n="lastclock";e={(convertfrom-epoch

$_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n='HeapUsed';e={[int]$_.lastvalue/1mb}},name,key_ |

ft -a



Get java heap used by hosts (JMX)









-------------------------- EXAMPLE 13 --------------------------



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost @zabSessionParams | ? name -NotMatch host | ? name -match

host).hostid | ? name -match "Commit|RAM Utilization" | ? name -notmatch "%" | ? key_ -notmatch "vmver" | select

@{n="lastclock";e={(convertfrom-epoch $_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n='RAM(GB)';e={[

math]::round($_.lastvalue/1gb,2)}},name,key_ | sort host,key_ | ft -a



Get hosts' RAM utilization









-------------------------- EXAMPLE 14 --------------------------



PS C:\\>Get-ZabbixItem -SortBy status -ItemKey pfree -HostId (Get-ZabbixHost | ? name -match hostName).hostid |

select @{n="hostname";e={$_.hosts.name}},@{n="Time(UTC)";e={convertfrom-epoch

$_.lastclock}},status,key_,lastvalue,name | sort hostname,key_ | ft -a



Get Items (disk usage(%) info) for multiple hosts









-------------------------- EXAMPLE 15 --------------------------



PS C:\\>Get-ZabbixItem -SortBy status -ItemKey pfree -HostId (Get-ZabbixHost | ? name -match hostName).hostid | ?

key_ -match "c:" | select @{n="hostname";e={$_.hosts.name}},@{n="Time(UTC)";e={convertfrom-epoch

$_.lastclock}},status,key_,lastvalue,name | sort hostname,key_ | ft -a



Get Items (disk usage info) according disk match for multiple hosts









-------------------------- EXAMPLE 16 --------------------------



PS C:\\>(1..8) | %{Get-ZabbixHost hostName-0$_ | Get-ZabbixItem -ItemKey 'java.lang:type=Memory' | ? status -match

0 | select key_,interfaces}



Get Items and their interface









-------------------------- EXAMPLE 17 --------------------------



PS C:\\>(1..8) | %{Get-ZabbixHost hostName-0$_ | Get-ZabbixItem -ItemKey 'MemoryUsage.used' | ? status -match 0 |

select @{n="Host";e={$_.hosts.name}},@{n="If.IP";e={$_.interfaces.ip}},@{n="If.Port";e={$_.interfaces.port}},@{n="A

pplication";e={$_.applications.name}},key_ } | ft -a



Get Items and interfaces









-------------------------- EXAMPLE 18 --------------------------



PS C:\\>Get-ZabbixItem -ItemKey 'version' -ItemName "Version of zabbix_agent(d) running" -HostId (Get-ZabbixHost |

? name -notmatch "DC2").hostid | ? status -match 0 | select

@{n="host";e={$_.hosts.name}},@{n="Application";e={$_.applications.name}},key_,lastvalue | sort host



Get Zabbix agent version









-------------------------- EXAMPLE 19 --------------------------



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match "hostName").hostid | ? key_ -match "version" | ?

key_ -notmatch "VmVersion" | ? lastvalue -ne 0 | ? applications -match "" | select

@{n="Time(UTC+1)";e={(convertfrom-epoch $_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n="Application

";e={$_.applications.name}},lastvalue,key_,@{n="If.IP";e={$_.interfaces.ip}},@{n="If.Port";e={$_.interfaces.port}}

| sort host | ft -a



Get Java application versions via JMX









-------------------------- EXAMPLE 20 --------------------------



PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match "hostName").hostid | ? key_ -match

"HeapMemoryUsage.committed" | ? lastvalue -ne 0 | ? applications -match "application" | select

@{n="Time(UTC+1)";e={(convertfrom-epoch $_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n="Application

";e={$_.applications.name}},lastvalue,key_,@{n="If.IP";e={$_.interfaces.ip}},@{n="If.Port";e={$_.interfaces.port}}

| sort host | ft -a



Get JVM memory usage via JMX









-------------------------- EXAMPLE 21 --------------------------



PS C:\\>Cassandra: Get-ZabbixItem -ItemName 'AntiEntropySessions' -HostId (Get-ZabbixHost | ? name -match

"cassandraNode").hostid | select @{n="hostname";e={$_.hosts.name}},name,@{e={(convertfrom-epoch

$_.lastclock).addhours(+1)};n="Time"},@{n="lastvalue";e={[math]::round(($_.lastvalue),2)}} | sort hostname | ft -a



Cassandra: Get-ZabbixItem -ItemName 'Compaction' -HostId (Get-ZabbixHost | ? name -match "cassandraNodes").hostid

| ? name -Match "CurrentlyBlockedTasks|Pending|ActiveTasks" | select

@{n="hostname";e={$_.hosts.name}},name,@{e={(convertfrom-epoch

$_.lastclock).addhours(+1)};n="Time"},@{n="lastvalue";e={[math]::round(($_.lastvalue),2)}} | sort hostname,name |

ft -a

Cassandra: Get-ZabbixItem -ItemName 'disk' -HostId (Get-ZabbixHost | ? name -match "cassandraNodes").hostid | ?

key_ -match "cassandra,free" | select @{n="hostname";e={$_.hosts.name}},key_,@{e={(convertfrom-epoch $_.lastclock).

addhours(+1)};n="Time"},@{n="prevvalue";e={[math]::round(($_.prevvalue/1gb),2)}},@{n="lastvalue";e={[math]::round((

$_.lastvalue/1gb),2)}} | sort hostname | ft -a

Cassandra: Get-ZabbixItem -ItemName 'byte' -HostId (Get-ZabbixHost | ? name -match "cassandraNodes").hostid |

select @{n="hostname";e={$_.hosts.name}},key_,@{e={(convertfrom-epoch $_.lastclock).addhours(+1)};n="Time"},@{n="pr

evvalue";e={[math]::round(($_.prevvalue/1gb),2)}},@{n="lastvalue";e={[math]::round(($_.lastvalue/1gb),2)}} | sort

hostname | ft -a











RELATED LINKS