< Back

Set-ZabbixHost

Sun Jan 19, 2020 6:14 pm

NAME Set-ZabbixHost



SYNOPSIS

Set/update host settings





SYNTAX

Set-ZabbixHost [[-HostName] <String>] [[-HostVisibleName] <String>] [[-HostID] <String>] [[-GroupID] <Array>]

[[-groups] <Array>] [[-interfaceID] <Array>] [[-interfaces] <Array>] [[-TemplateID] <Array>] [[-parentTemplates]

<Array>] [[-templates] <Array>] [[-Inventory] <Object>] [[-HostDescription] <String>] [[-InventoryMode] <Int32>]

[[-IpmiAuthtype] <Int32>] [[-IpmiUsername] <String>] [[-IpmiPassword] <String>] [[-IpmiPrivilege] <Int32>]

[[-HttpTestID] <Array>] [[-status] <Int32>] [[-ProxyHostID] <Int32>] [-removeTemplates] [[-jsonrpc] <String>]

[[-session] <String>] [[-id] <String>] [[-URL] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Set/update host settings





PARAMETERS

-HostName <String>

Host name



Required? false

Position? 1

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostVisibleName <String>

Host visible name: Default: host property value



Required? false

Position? 2

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostID <String>

HostID



Required? false

Position? 3

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-GroupID <Array>

GroupID of host group



Required? false

Position? 4

Default value

Accept pipeline input? false

Accept wildcard characters? false



-groups <Array>



Required? false

Position? 5

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-interfaceID <Array>



Required? false

Position? 6

Default value

Accept pipeline input? false

Accept wildcard characters? false



-interfaces <Array>



Required? false

Position? 7

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-TemplateID <Array>



Required? false

Position? 8

Default value

Accept pipeline input? false

Accept wildcard characters? false



-parentTemplates <Array>



Required? false

Position? 9

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-templates <Array>

[Alias("parentTemplates")][Parameter(Mandatory=$False,ValueFromPipelineByPropertyName=$True)][array]$templates,



Required? false

Position? 10

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-Inventory <Object>



Required? false

Position? 11

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HostDescription <String>

Description of the host



Required? false

Position? 12

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-InventoryMode <Int32>

InventoryMode: Possible values are: -1 - disabled; 0 - (default) manual; 1 - automatic



Required? false

Position? 13

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-IpmiAuthtype <Int32>

IPMI: IpmiAuthtype: IPMI authentication algorithm: Possible values are: -1 - (default) default; 0 - none; 1 -

MD2; 2 - MD5 4 - straight; 5 - OEM; 6 - RMCP+



Required? false

Position? 14

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-IpmiUsername <String>

IPMI: IpmiUsername: IPMI username



Required? false

Position? 15

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-IpmiPassword <String>

IPMI: IpmiPassword: IPMI password



Required? false

Position? 16

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-IpmiPrivilege <Int32>

IPMI: IpmiPrivilege: IPMI privilege level: Possible values are: 1 - callback; 2 - (default) user; 3 -

operator; 4 - admin; 5 - OEM



Required? false

Position? 17

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-HttpTestID <Array>

[array]$GroupID,



Required? false

Position? 18

Default value

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-status <Int32>

Status and function of the host: Possible values are: 0 - (default) monitored host; 1 - unmonitored host



Required? false

Position? 19

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-ProxyHostID <Int32>



Required? false

Position? 20

Default value 0

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-removeTemplates [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-jsonrpc <String>



Required? false

Position? 21

Default value ($global:zabSessionParams.jsonrpc)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-session <String>



Required? false

Position? 22

Default value ($global:zabSessionParams.session)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-id <String>



Required? false

Position? 23

Default value ($global:zabSessionParams.id)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-URL <String>



Required? false

Position? 24

Default value ($global:zabSessionParams.url)

Accept pipeline input? true (ByPropertyName)

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

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 -eq "host" | Set-ZabbixHost -status 0



Enable host (-status 0)









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



PS C:\\>(1..9) | %{(Get-ZabbixHost | ? name -eq "host0$_") | Set-ZabbixHost -status 1}



Disable multiple hosts (-status 1)









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



PS C:\\>Get-ZabbixHost | ? name -match "hostName" | Set-ZabbixHost -status 0



Enable multiple hosts









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



PS C:\\>Get-ZabbixHost | ? name -match hostName | Set-ZabbixHost -GroupID 14,16 -status 0



Set HostGroups for the host(s) and enable it









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



PS C:\\>Get-ZabbixHost | ? name -eq hostName | Set-ZabbixHost -removeTemplates -WhatIf



WhatIf on delete and clear of all templates from the host









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



PS C:\\>Get-ZabbixHost | ? name -eq hostName | Set-ZabbixHost -removeTemplates



Remove and clear all linked templates from the host









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



PS C:\\>Get-ZabbixHost | ? name -eq hostName | Set-ZabbixHost -TemplateID (Get-ZabbixTemplate | ? name -eq

"TemplateFromCurrentHost").templateid



Replace linked templates on the host with new ones (not clear the old ones)









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



PS C:\\>Get-ZabbixHost | ? name -eq hostName | Set-ZabbixHost -removeTemplates -TemplateID (Get-ZabbixTemplate | ?

name -eq "TemplateFromCurrentHost").templateid -WhatIf



WhatIf on remove and clear linked templates from the host









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



PS C:\\>Get-ZabbixHost -HostName HostName | Set-ZabbixHost -removeTemplates -TemplateID (Get-ZabbixHost -HostName

"HostName").parentTemplates.templateid



Unlink(remove) and clear templates from the host (case sensitive)









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



PS C:\\>$templateID=(Get-ZabbixTemplate -HostID (Get-ZabbixHost | ? name -match hostname).hostid).templateid



Store existing templateIDs

$templateID+=(Get-ZabbixTemplate | ? name -match "newTemplate").templateid

Add new templateIDs

Get-ZabbixHost | ? name -match hosts | Set-ZabbixHost -TemplateID $templateID

Link(add) additional template(s) to already existing ones, step by step









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



PS C:\\>$templateID=((Get-ZabbixHost | ? name -eq hostName).parentTemplates.templateid)+((Get-ZabbixTemplate | ?

name -match mysql).templateid)



Get-ZabbixHost | ? name -ew hostName | Set-ZabbixHost -TemplateID $templateID

Add new template to existing ones (not replace)









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



PS C:\\>Get-ZabbixHost -HostName HostName | Set-ZabbixHost -TemplateID (Get-ZabbixHost -HostName

SourceHost).parentTemplates.templateid



Link(replace existing) new templates to the host, according config of other host (case sensitive)









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



PS C:\\>(1..9) | %{Get-ZabbixHost -HostName "Host0$_" | Set-ZabbixHost -TemplateID ((Get-ZabbixHost | ? name -match

"sourcehost").parenttemplates.templateid)}



Link(replace existing) new templates to multiple hosts, according config of the other host











RELATED LINKS