< Back
New-ZabbixHostInterface
Post
NAME New-ZabbixHostInterface
SYNOPSIS
Create host interface
SYNTAX
New-ZabbixHostInterface [-HostID] <String> [-IP] <String> [[-DNS] <String>] [-Port] <String> [-main] <String>
[-type] <String> [[-useIP] <String>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL]
<String>] [<CommonParameters>]
DESCRIPTION
Create host interface
PARAMETERS
-HostID <String>
HostID
Required? true
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-IP <String>
Interface IP address
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-DNS <String>
Interface DNS name
Required? false
Position? 3
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Port <String>
Interface Port
Required? true
Position? 4
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-main <String>
Interface Main: Possible values are: 0 - not default; 1 - default
Required? true
Position? 5
Default value 0
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-type <String>
Interface Type: Possible values are: 1 - agent; 2 - SNMP; 3 - IPMI; 4 - JMX
Required? true
Position? 6
Default value 4
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-useIP <String>
Interface UseIP: Possible values are: 0 - connect using host DNS name; 1 - connect using host IP address for
this host interface
Required? false
Position? 7
Default value 1
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-jsonrpc <String>
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$true)][string]$InterfaceID,
Required? false
Position? 8
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? false
Accept wildcard characters? false
-session <String>
Required? false
Position? 9
Default value ($global:zabSessionParams.session)
Accept pipeline input? false
Accept wildcard characters? false
-id <String>
Required? false
Position? 10
Default value ($global:zabSessionParams.id)
Accept pipeline input? false
Accept wildcard characters? false
-URL <String>
Required? false
Position? 11
Default value ($global:zabSessionParams.url)
Accept pipeline input? false
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-ZabbixHost | ? name -match host | New-ZabbixHostInterface -IP 10.20.10.15 -port 31721
Create new interface for host
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match "host01" | New-ZabbixHostInterface -Port 31721 -type 4 -main 1 -ip
(Get-ZabbixHost | ? name -match "host01").interfaces.ip
Create new interface for host
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match hosts | select hostid,name,@{n="ip";e={$_.interfaces.ip}} |
New-ZabbixHostInterface -Port 31001 -type 4 -main 1 -verbose
Get-ZabbixHost | ? name -match hosts | select name,*error* | ft -a
Create new JMX (-type 4) interface to hosts and check if interface has no errors
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | New-ZabbixHostInterface -Port 31721 -type 4 -main 0
-ip (Get-ZabbixHost | ? name -match "host0$_").interfaces.ip[0]}
Create new interface for multiple hosts
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | Get-ZabbixHostInterface | ? port -match 31751 |
Set-ZabbixHostInterface -main 0}
Make existing JMX port not default
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | New-ZabbixHostInterface -Port 31771 -type 4 -main 1
-ip (Get-ZabbixHost | ? name -match "host0$_").interfaces.ip[0]}
Create new JMX interface and set it default
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match "one|two|three|four").hostid | ? key_ -match
"version" | ? key_ -notmatch "VmVersion" | ? lastvalue -ne 0 | ? applications -match "app1|app2|app3|app3" |
select @{n="host";e={$_.hosts.name}},@{n="Application";e={$_.applications.name}},lastvalue,key_,interfaces | sort
host,application | ft -a
Check whether new settings are working
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ? port -match 31021 |
Set-ZabbixHostInterface -main 0
Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ? port -match 31021 | ft -a
Get-ZabbixHost | ? name -match hostname | select hostid,name,@{n="ip";e={$_.interfaces.ip[0]}} |
New-ZabbixHostInterface -Port 31001 -type 4 -main 1 -verbose
Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ft -a
Manually add new template for created interface
Run the checks:
Get-ZabbixHost | ? name -match hostname | select name,*error* | ft -a
Get-ZabbixHost | ? name -match hostname | select name,*jmx* | ft -a
Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match hostname).hostid | ? key_ -match
"Version|ProductName|HeapMemoryUsage.used" | ? key_ -notmatch "vmver" | select
@{n="lastclock";e={(convertfrom-epoch $_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n="Application";
e={$_.applications.name}},lastvalue,key_ | sort host,application,key_ | ft -a
Add new JMX interface with matching new JMX template, step by step
RELATED LINKS
SYNOPSIS
Create host interface
SYNTAX
New-ZabbixHostInterface [-HostID] <String> [-IP] <String> [[-DNS] <String>] [-Port] <String> [-main] <String>
[-type] <String> [[-useIP] <String>] [[-jsonrpc] <String>] [[-session] <String>] [[-id] <String>] [[-URL]
<String>] [<CommonParameters>]
DESCRIPTION
Create host interface
PARAMETERS
-HostID <String>
HostID
Required? true
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-IP <String>
Interface IP address
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-DNS <String>
Interface DNS name
Required? false
Position? 3
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Port <String>
Interface Port
Required? true
Position? 4
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-main <String>
Interface Main: Possible values are: 0 - not default; 1 - default
Required? true
Position? 5
Default value 0
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-type <String>
Interface Type: Possible values are: 1 - agent; 2 - SNMP; 3 - IPMI; 4 - JMX
Required? true
Position? 6
Default value 4
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-useIP <String>
Interface UseIP: Possible values are: 0 - connect using host DNS name; 1 - connect using host IP address for
this host interface
Required? false
Position? 7
Default value 1
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-jsonrpc <String>
[Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$true)][string]$InterfaceID,
Required? false
Position? 8
Default value ($global:zabSessionParams.jsonrpc)
Accept pipeline input? false
Accept wildcard characters? false
-session <String>
Required? false
Position? 9
Default value ($global:zabSessionParams.session)
Accept pipeline input? false
Accept wildcard characters? false
-id <String>
Required? false
Position? 10
Default value ($global:zabSessionParams.id)
Accept pipeline input? false
Accept wildcard characters? false
-URL <String>
Required? false
Position? 11
Default value ($global:zabSessionParams.url)
Accept pipeline input? false
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-ZabbixHost | ? name -match host | New-ZabbixHostInterface -IP 10.20.10.15 -port 31721
Create new interface for host
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match "host01" | New-ZabbixHostInterface -Port 31721 -type 4 -main 1 -ip
(Get-ZabbixHost | ? name -match "host01").interfaces.ip
Create new interface for host
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match hosts | select hostid,name,@{n="ip";e={$_.interfaces.ip}} |
New-ZabbixHostInterface -Port 31001 -type 4 -main 1 -verbose
Get-ZabbixHost | ? name -match hosts | select name,*error* | ft -a
Create new JMX (-type 4) interface to hosts and check if interface has no errors
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | New-ZabbixHostInterface -Port 31721 -type 4 -main 0
-ip (Get-ZabbixHost | ? name -match "host0$_").interfaces.ip[0]}
Create new interface for multiple hosts
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | Get-ZabbixHostInterface | ? port -match 31751 |
Set-ZabbixHostInterface -main 0}
Make existing JMX port not default
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>(1..100) | %{Get-ZabbixHost | ? name -match "host0$_" | New-ZabbixHostInterface -Port 31771 -type 4 -main 1
-ip (Get-ZabbixHost | ? name -match "host0$_").interfaces.ip[0]}
Create new JMX interface and set it default
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match "one|two|three|four").hostid | ? key_ -match
"version" | ? key_ -notmatch "VmVersion" | ? lastvalue -ne 0 | ? applications -match "app1|app2|app3|app3" |
select @{n="host";e={$_.hosts.name}},@{n="Application";e={$_.applications.name}},lastvalue,key_,interfaces | sort
host,application | ft -a
Check whether new settings are working
-------------------------- EXAMPLE 8 --------------------------
PS C:\\>Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ? port -match 31021 |
Set-ZabbixHostInterface -main 0
Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ? port -match 31021 | ft -a
Get-ZabbixHost | ? name -match hostname | select hostid,name,@{n="ip";e={$_.interfaces.ip[0]}} |
New-ZabbixHostInterface -Port 31001 -type 4 -main 1 -verbose
Get-ZabbixHost | ? name -match hostname | Get-ZabbixHostInterface | ft -a
Manually add new template for created interface
Run the checks:
Get-ZabbixHost | ? name -match hostname | select name,*error* | ft -a
Get-ZabbixHost | ? name -match hostname | select name,*jmx* | ft -a
Get-ZabbixItem -HostId (Get-ZabbixHost | ? name -match hostname).hostid | ? key_ -match
"Version|ProductName|HeapMemoryUsage.used" | ? key_ -notmatch "vmver" | select
@{n="lastclock";e={(convertfrom-epoch $_.lastclock).addhours(+1)}},@{n="host";e={$_.hosts.name}},@{n="Application";
e={$_.applications.name}},lastvalue,key_ | sort host,application,key_ | ft -a
Add new JMX interface with matching new JMX template, step by step
RELATED LINKS