< Back

New-ZabbixHost

Sun Jan 19, 2020 6:12 pm

NAME New-ZabbixHost



SYNOPSIS

Create new host





SYNTAX

New-ZabbixHost [-HostName] <String> [[-IP] <String>] [[-DNSName] <String>] [-MonitorByDNSName] [[-Port] <String>]

[-status] <String> [[-GroupID] <Array>] [[-groups] <Array>] [[-TemplateID] <Array>] [[-ProxyHostID] <Int32>]

[[-templates] <Array>] [[-interfaces] <Array>] [[-parentTemplates] <Array>] [[-jsonrpc] <String>] [[-session]

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





DESCRIPTION

Create new host





PARAMETERS

-HostName <String>

HostName of the host as it will appear in zabbix



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-IP <String>

IP address of the host



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DNSName <String>

Domain name of the host



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MonitorByDNSName [<SwitchParameter>]

If used, domain name of the host will used to connect



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Port <String>

Port to connect to the host (default 10050)



Required? false

Position? 4

Default value 10050

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-status <String>



Required? true

Position? 5

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-GroupID <Array>

ID of the group host will belong to



Required? false

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-groups <Array>



Required? false

Position? 7

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TemplateID <Array>

ID/IDs of the templates to link to the host



Required? false

Position? 8

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ProxyHostID <Int32>



Required? false

Position? 9

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-templates <Array>



Required? false

Position? 10

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-interfaces <Array>



Required? false

Position? 11

Default value

Accept pipeline input? false

Accept wildcard characters? false



-parentTemplates <Array>



Required? false

Position? 12

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 13

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? 14

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? 15

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? 16

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:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -GroupID 8,14 -TemplateID "10081","10166"



Create new host (case sensitive), with two linked Templates and member of two HostGroups









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



PS C:\\>New-ZabbixHost -HostName hostName -IP 10.20.10.10 -TemplateID (Get-ZabbixTemplate | ? name -eq "Template OS

Windows").templateid -GroupID (Get-ZabbixGroup | ? name -eq "HostGroup").groupid -status 1



Create new host (case sensitive), with one linked Template, member of one HostGroup and disabled (-status 1)









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



PS C:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -TemplateID ((Get-ZabbixTemplate | ? name -match "Template

OS Windows|Template OS Windows - Ext") -notmatch "Template OS Windows - Backup").templateid -GroupID

(Get-ZabbixHostGroup | ? name -match "HostGroup1|HostGroup2").groupid -status 1



Create new host (case sensitive), with two linked Templates, member of two HostGroups and disabled (-status 1)









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



PS C:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -GroupID 8 -TemplateID (Get-ZabbixHost | ? name -match

"host").parentTemplates.templateid -status 0



Create new host (case sensitive), with multiple attached Templates and enable it (-status 0)









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



PS C:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -GroupID 8 -TemplateID (Get-ZabbixHost | ? name -match

"host").parentTemplates.templateid -status 1



Create new host (case sensitive), with multiple attached Templates and leave it disabled (-status 1)









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



PS C:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -TemplateID ((Get-ZabbixTemplate | ? name -match "Template

OS Windows") -notmatch "Template OS Windows - Backup").templateid -verbose -GroupID (Get-ZabbixGroup | ? name

-match "HostGroup1|HostGroup2").groupid -status 1 -DNSName NewHost.example.com -MonitorByDNSName



Create new host with FQDN and set monitoring according DNS and not IP









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



PS C:\\>Import-Csv c:\\new-servers.csv | %{New-ZabbixHost -HostName $_.$Hostname -IP $_.IP -TemplateID

"10081","10166" -GroupID 8,14}



Mass create new hosts









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



PS C:\\>Import-Csv c:\\new-servers.csv | %{New-ZabbixHost -HostName $_.Hostname -IP $_.IP -GroupID $_.GroupID

-TemplateID $_.TemplateID -status $_.status}



Mass create new hosts









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



PS C:\\>New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -GroupID (Get-ZabbixHost | ? name -eq

"SourceHost").groups.groupid -TemplateID (Get-ZabbixHost | ? name -eq "SourceHost" | Get-ZabbixTemplate | ? name

-match os).templateid -status 1 -verbose



Clone HostGroups and Templates from other host









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



PS C:\\>Get-ZabbixHost | ? name -match SourceHost | New-ZabbixHost -HostName NewHost -IP 10.20.10.10 -status 1



Partially clone host (templates and groups will be copied from the source host)









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



PS C:\\>Get-ZabbixHost | ? name -eq SourceHost | Get-ZabbixApplication | New-ZabbixApplication -HostID

(Get-ZabbixHost | ? name -match newHost).hostid



Clone Application(s) from host to host











RELATED LINKS