Public/adc-functions-conf-snmp.ps1
function Invoke-ADCUpdateSnmpalarm { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for alarm resource. .PARAMETER Trapname Name of the SNMP alarm. This parameter is required for identifying the SNMP alarm and cannot be modified. Possible values = CPU-USAGE, AVERAGE-CPU, MEMORY, MGMT-CPU-USAGE, SYNFLOOD, TCP-SYNFLOOD, VSERVER-REQRATE, SERVICE-REQRATE, ENTITY-RXRATE, ENTITY-TXRATE, ENTITY-SYNFLOOD, SERVICE-MAXCLIENTS, HA-STATE-CHANGE, ENTITY-STATE, CONFIG-CHANGE, CONFIG-SAVE, SERVICEGROUP-MEMBER-REQRATE, SERVICEGROUP-MEMBER-MAXCLIENTS, MONITOR-RTO-THRESHOLD, LOGIN-FAILURE, SSL-CERT-EXPIRY, FAN-SPEED-LOW, VOLTAGE-LOW, VOLTAGE-HIGH, TEMPERATURE-HIGH, CPU-TEMPERATURE-HIGH, POWER-SUPPLY-FAILURE, DISK-USAGE-HIGH, INTERFACE-THROUGHPUT-LOW, MON_PROBE_FAILED, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS, HA-BAD-SECONDARY-STATE, INTERFACE-BW-USAGE, RATE-LIMIT-THRESHOLD-EXCEEDED, ENTITY-NAME-CHANGE, HA-PROP-FAILURE, IP-CONFLICT, PF-RL-RATE-THRESHOLD, PF-RL-PPS-THRESHOLD, PF-RL-RATE-PKTS-DROPPED, PF-RL-PPS-PKTS-DROPPED, APPFW-START-URL, APPFW-DENY-URL, APPFW-VIOLATIONS-TYPE, APPFW-REFERER-HEADER, APPFW-CSRF-TAG, APPFW-COOKIE, APPFW-FIELD-CONSISTENCY, APPFW-BUFFER-OVERFLOW, APPFW-FIELD-FORMAT, APPFW-FILE-UPLOAD-TYPE, APPFW-JSON-DOS, APPFW-JSON-SQL, APPFW-JSON-XSS, APPFW-SAFE-COMMERCE, APPFW-SAFE-OBJECT, APPFW-SESSION-LIMIT, APPFW-SIGNATURE-MATCH, APPFW-POLICY-HIT, APPFW-XSS, APPFW-XML-XSS, APPFW-SQL, APPFW-XML-SQL, APPFW-XML-ATTACHMENT, APPFW-XML-DOS, APPFW-XML-VALIDATION, APPFW-XML-WSI, APPFW-XML-SCHEMA-COMPILE, APPFW-XML-SOAP-FAULT, APPFW-NEW-SIGNATURE-ADDED, APPFW-DEPLOY-RELAXATION-DP, APPFW-LEARNED-RULE-APPLIED-DYN-PROF, APPFW-CMD, APPFW-POSTBODYLIMIT, APPFW-JSON-CMD, APPFW-SQL-GRAM, APPFW-JSON-SQL-GRAM, DNSKEY-EXPIRY, HA-LICENSE-MISMATCH, SSL-CARD-FAILED, SSL-CARD-NORMAL, WARM-RESTART-EVENT, HARD-DISK-DRIVE-ERRORS, COMPACT-FLASH-ERRORS, CALLHOME-UPLOAD-EVENT, 1024KEY-EXCHANGE-RATE, 2048KEY-EXCHANGE-RATE, 4096KEY-EXCHANGE-RATE, SSL-CUR-SESSION-INUSE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-CCO-CHANGE, CLUSTER-OVS-CHANGE, CLUSTER-SYNC-FAILURE, CLUSTER-SYNC-PARTIAL-SUCCESS, CLUSTER-PROP-FAILURE, HA-STICKY-PRIMARY, INBAND-PROTOCOL-VERSION-MISMATCH, SSL-CHIP-REINIT, VRID-STATE-CHANGE, PORT-ALLOC-FAILED, LLDP-REMOTE-CHANGE, DUPLICATE-IPV6, PARTITION-CONFIG-EVENT, PARTITION-SWITCHED, LSN-PORTALLOC-FAILED, LSN-PORTQUOTA-EXCEED, LSN-SESSIONQUOTA-EXCEED, LSN-MEM-RECOVERY-KICKEDIN, VSERVER-SPILLOVER, PARTITION-RATE-LIMIT, POOLED-LICENSE-ONGRACE, POOLED-LICENSE-PARTIAL, CLUSTER-BACKPLANE-HB-MISSING, GSLB-SITE-MEP-FLAP, DNS-MAXNEGCACHE-USAGE, DNS-MAXCACHE-USAGE, NS-LICENSE-EXPIRY, PKT-RATELIMITING-ATTACK, GSLB-SYNC-STATUS-FLIP, URLFILT-DB-UPDATE-STATUS, URLFILT-INIT-SDK, POOLED-LICENSE-CHECKOUT-FAILURE, MIGRATION-STARTED, MIGRATION-COMPLETE, ECDHE-EXCHANGE-RATE, BOT-SIGNATURE-UPDATE, APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH .PARAMETER Thresholdvalue Value for the high threshold. The Citrix ADC generates an SNMP trap message when the value of the attribute associated with the alarm is greater than or equal to the specified high threshold value. .PARAMETER Normalvalue Value for the normal threshold. A trap message is generated if the value of the respective attribute falls to or below this value after exceeding the high threshold. .PARAMETER Time Interval, in seconds, at which the Citrix ADC generates SNMP trap messages when the conditions specified in the SNMP alarm are met.Can be specified for the following alarms: SYNFLOOD, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS,HA-BAD-SECONDARY-STATE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-BKHB-FAILED, PORT-ALLOC-FAILED, COMPACT-FLASH-ERRORS, HARD-DISK-DRIVE-ERRORS and APPFW traps. Default trap time intervals: SYNFLOOD and APPFW traps = 1sec, PORT-ALLOC-FAILED = 3600sec(1 hour), Other Traps = 86400sec(1 day). .PARAMETER State Current state of the SNMP alarm. The Citrix ADC generates trap messages only for SNMP alarms that are enabled. Some alarms are enabled by default, but you can disable them. Possible values = ENABLED, DISABLED .PARAMETER Severity Severity level assigned to trap messages generated by this alarm. The severity levels are, in increasing order of severity, Informational, Warning, Minor, Major, and Critical. This parameter is useful when you want the Citrix ADC to send trap messages to a trap listener on the basis of severity level. Trap messages with a severity level lower than the specified level (in the trap listener entry) are not sent. Possible values = Critical, Major, Minor, Warning, Informational .PARAMETER Logging Logging status of the alarm. When logging is enabled, the Citrix ADC logs every trap message that is generated for this alarm. Possible values = ENABLED, DISABLED .PARAMETER PassThru Return details about the created snmpalarm item. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpalarm -trapname <string> An example how to update snmpalarm configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpalarm Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpalarm/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('CPU-USAGE', 'AVERAGE-CPU', 'MEMORY', 'MGMT-CPU-USAGE', 'SYNFLOOD', 'TCP-SYNFLOOD', 'VSERVER-REQRATE', 'SERVICE-REQRATE', 'ENTITY-RXRATE', 'ENTITY-TXRATE', 'ENTITY-SYNFLOOD', 'SERVICE-MAXCLIENTS', 'HA-STATE-CHANGE', 'ENTITY-STATE', 'CONFIG-CHANGE', 'CONFIG-SAVE', 'SERVICEGROUP-MEMBER-REQRATE', 'SERVICEGROUP-MEMBER-MAXCLIENTS', 'MONITOR-RTO-THRESHOLD', 'LOGIN-FAILURE', 'SSL-CERT-EXPIRY', 'FAN-SPEED-LOW', 'VOLTAGE-LOW', 'VOLTAGE-HIGH', 'TEMPERATURE-HIGH', 'CPU-TEMPERATURE-HIGH', 'POWER-SUPPLY-FAILURE', 'DISK-USAGE-HIGH', 'INTERFACE-THROUGHPUT-LOW', 'MON_PROBE_FAILED', 'HA-VERSION-MISMATCH', 'HA-SYNC-FAILURE', 'HA-NO-HEARTBEATS', 'HA-BAD-SECONDARY-STATE', 'INTERFACE-BW-USAGE', 'RATE-LIMIT-THRESHOLD-EXCEEDED', 'ENTITY-NAME-CHANGE', 'HA-PROP-FAILURE', 'IP-CONFLICT', 'PF-RL-RATE-THRESHOLD', 'PF-RL-PPS-THRESHOLD', 'PF-RL-RATE-PKTS-DROPPED', 'PF-RL-PPS-PKTS-DROPPED', 'APPFW-START-URL', 'APPFW-DENY-URL', 'APPFW-VIOLATIONS-TYPE', 'APPFW-REFERER-HEADER', 'APPFW-CSRF-TAG', 'APPFW-COOKIE', 'APPFW-FIELD-CONSISTENCY', 'APPFW-BUFFER-OVERFLOW', 'APPFW-FIELD-FORMAT', 'APPFW-FILE-UPLOAD-TYPE', 'APPFW-JSON-DOS', 'APPFW-JSON-SQL', 'APPFW-JSON-XSS', 'APPFW-SAFE-COMMERCE', 'APPFW-SAFE-OBJECT', 'APPFW-SESSION-LIMIT', 'APPFW-SIGNATURE-MATCH', 'APPFW-POLICY-HIT', 'APPFW-XSS', 'APPFW-XML-XSS', 'APPFW-SQL', 'APPFW-XML-SQL', 'APPFW-XML-ATTACHMENT', 'APPFW-XML-DOS', 'APPFW-XML-VALIDATION', 'APPFW-XML-WSI', 'APPFW-XML-SCHEMA-COMPILE', 'APPFW-XML-SOAP-FAULT', 'APPFW-NEW-SIGNATURE-ADDED', 'APPFW-DEPLOY-RELAXATION-DP', 'APPFW-LEARNED-RULE-APPLIED-DYN-PROF', 'APPFW-CMD', 'APPFW-POSTBODYLIMIT', 'APPFW-JSON-CMD', 'APPFW-SQL-GRAM', 'APPFW-JSON-SQL-GRAM', 'DNSKEY-EXPIRY', 'HA-LICENSE-MISMATCH', 'SSL-CARD-FAILED', 'SSL-CARD-NORMAL', 'WARM-RESTART-EVENT', 'HARD-DISK-DRIVE-ERRORS', 'COMPACT-FLASH-ERRORS', 'CALLHOME-UPLOAD-EVENT', '1024KEY-EXCHANGE-RATE', '2048KEY-EXCHANGE-RATE', '4096KEY-EXCHANGE-RATE', 'SSL-CUR-SESSION-INUSE', 'CLUSTER-NODE-HEALTH', 'CLUSTER-NODE-QUORUM', 'CLUSTER-VERSION-MISMATCH', 'CLUSTER-CCO-CHANGE', 'CLUSTER-OVS-CHANGE', 'CLUSTER-SYNC-FAILURE', 'CLUSTER-SYNC-PARTIAL-SUCCESS', 'CLUSTER-PROP-FAILURE', 'HA-STICKY-PRIMARY', 'INBAND-PROTOCOL-VERSION-MISMATCH', 'SSL-CHIP-REINIT', 'VRID-STATE-CHANGE', 'PORT-ALLOC-FAILED', 'LLDP-REMOTE-CHANGE', 'DUPLICATE-IPV6', 'PARTITION-CONFIG-EVENT', 'PARTITION-SWITCHED', 'LSN-PORTALLOC-FAILED', 'LSN-PORTQUOTA-EXCEED', 'LSN-SESSIONQUOTA-EXCEED', 'LSN-MEM-RECOVERY-KICKEDIN', 'VSERVER-SPILLOVER', 'PARTITION-RATE-LIMIT', 'POOLED-LICENSE-ONGRACE', 'POOLED-LICENSE-PARTIAL', 'CLUSTER-BACKPLANE-HB-MISSING', 'GSLB-SITE-MEP-FLAP', 'DNS-MAXNEGCACHE-USAGE', 'DNS-MAXCACHE-USAGE', 'NS-LICENSE-EXPIRY', 'PKT-RATELIMITING-ATTACK', 'GSLB-SYNC-STATUS-FLIP', 'URLFILT-DB-UPDATE-STATUS', 'URLFILT-INIT-SDK', 'POOLED-LICENSE-CHECKOUT-FAILURE', 'MIGRATION-STARTED', 'MIGRATION-COMPLETE', 'ECDHE-EXCHANGE-RATE', 'BOT-SIGNATURE-UPDATE', 'APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH')] [string]$Trapname, [double]$Thresholdvalue, [double]$Normalvalue, [double]$Time, [ValidateSet('ENABLED', 'DISABLED')] [string]$State, [ValidateSet('Critical', 'Major', 'Minor', 'Warning', 'Informational')] [string]$Severity, [ValidateSet('ENABLED', 'DISABLED')] [string]$Logging, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCUpdateSnmpalarm: Starting" } process { try { $payload = @{ trapname = $trapname } if ( $PSBoundParameters.ContainsKey('thresholdvalue') ) { $payload.Add('thresholdvalue', $thresholdvalue) } if ( $PSBoundParameters.ContainsKey('normalvalue') ) { $payload.Add('normalvalue', $normalvalue) } if ( $PSBoundParameters.ContainsKey('time') ) { $payload.Add('time', $time) } if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) } if ( $PSBoundParameters.ContainsKey('severity') ) { $payload.Add('severity', $severity) } if ( $PSBoundParameters.ContainsKey('logging') ) { $payload.Add('logging', $logging) } if ( $PSCmdlet.ShouldProcess("snmpalarm", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpalarm -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpalarm -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpalarm: Finished" } } function Invoke-ADCUnsetSnmpalarm { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for alarm resource. .PARAMETER Trapname Name of the SNMP alarm. This parameter is required for identifying the SNMP alarm and cannot be modified. Possible values = CPU-USAGE, AVERAGE-CPU, MEMORY, MGMT-CPU-USAGE, SYNFLOOD, TCP-SYNFLOOD, VSERVER-REQRATE, SERVICE-REQRATE, ENTITY-RXRATE, ENTITY-TXRATE, ENTITY-SYNFLOOD, SERVICE-MAXCLIENTS, HA-STATE-CHANGE, ENTITY-STATE, CONFIG-CHANGE, CONFIG-SAVE, SERVICEGROUP-MEMBER-REQRATE, SERVICEGROUP-MEMBER-MAXCLIENTS, MONITOR-RTO-THRESHOLD, LOGIN-FAILURE, SSL-CERT-EXPIRY, FAN-SPEED-LOW, VOLTAGE-LOW, VOLTAGE-HIGH, TEMPERATURE-HIGH, CPU-TEMPERATURE-HIGH, POWER-SUPPLY-FAILURE, DISK-USAGE-HIGH, INTERFACE-THROUGHPUT-LOW, MON_PROBE_FAILED, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS, HA-BAD-SECONDARY-STATE, INTERFACE-BW-USAGE, RATE-LIMIT-THRESHOLD-EXCEEDED, ENTITY-NAME-CHANGE, HA-PROP-FAILURE, IP-CONFLICT, PF-RL-RATE-THRESHOLD, PF-RL-PPS-THRESHOLD, PF-RL-RATE-PKTS-DROPPED, PF-RL-PPS-PKTS-DROPPED, APPFW-START-URL, APPFW-DENY-URL, APPFW-VIOLATIONS-TYPE, APPFW-REFERER-HEADER, APPFW-CSRF-TAG, APPFW-COOKIE, APPFW-FIELD-CONSISTENCY, APPFW-BUFFER-OVERFLOW, APPFW-FIELD-FORMAT, APPFW-FILE-UPLOAD-TYPE, APPFW-JSON-DOS, APPFW-JSON-SQL, APPFW-JSON-XSS, APPFW-SAFE-COMMERCE, APPFW-SAFE-OBJECT, APPFW-SESSION-LIMIT, APPFW-SIGNATURE-MATCH, APPFW-POLICY-HIT, APPFW-XSS, APPFW-XML-XSS, APPFW-SQL, APPFW-XML-SQL, APPFW-XML-ATTACHMENT, APPFW-XML-DOS, APPFW-XML-VALIDATION, APPFW-XML-WSI, APPFW-XML-SCHEMA-COMPILE, APPFW-XML-SOAP-FAULT, APPFW-NEW-SIGNATURE-ADDED, APPFW-DEPLOY-RELAXATION-DP, APPFW-LEARNED-RULE-APPLIED-DYN-PROF, APPFW-CMD, APPFW-POSTBODYLIMIT, APPFW-JSON-CMD, APPFW-SQL-GRAM, APPFW-JSON-SQL-GRAM, DNSKEY-EXPIRY, HA-LICENSE-MISMATCH, SSL-CARD-FAILED, SSL-CARD-NORMAL, WARM-RESTART-EVENT, HARD-DISK-DRIVE-ERRORS, COMPACT-FLASH-ERRORS, CALLHOME-UPLOAD-EVENT, 1024KEY-EXCHANGE-RATE, 2048KEY-EXCHANGE-RATE, 4096KEY-EXCHANGE-RATE, SSL-CUR-SESSION-INUSE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-CCO-CHANGE, CLUSTER-OVS-CHANGE, CLUSTER-SYNC-FAILURE, CLUSTER-SYNC-PARTIAL-SUCCESS, CLUSTER-PROP-FAILURE, HA-STICKY-PRIMARY, INBAND-PROTOCOL-VERSION-MISMATCH, SSL-CHIP-REINIT, VRID-STATE-CHANGE, PORT-ALLOC-FAILED, LLDP-REMOTE-CHANGE, DUPLICATE-IPV6, PARTITION-CONFIG-EVENT, PARTITION-SWITCHED, LSN-PORTALLOC-FAILED, LSN-PORTQUOTA-EXCEED, LSN-SESSIONQUOTA-EXCEED, LSN-MEM-RECOVERY-KICKEDIN, VSERVER-SPILLOVER, PARTITION-RATE-LIMIT, POOLED-LICENSE-ONGRACE, POOLED-LICENSE-PARTIAL, CLUSTER-BACKPLANE-HB-MISSING, GSLB-SITE-MEP-FLAP, DNS-MAXNEGCACHE-USAGE, DNS-MAXCACHE-USAGE, NS-LICENSE-EXPIRY, PKT-RATELIMITING-ATTACK, GSLB-SYNC-STATUS-FLIP, URLFILT-DB-UPDATE-STATUS, URLFILT-INIT-SDK, POOLED-LICENSE-CHECKOUT-FAILURE, MIGRATION-STARTED, MIGRATION-COMPLETE, ECDHE-EXCHANGE-RATE, BOT-SIGNATURE-UPDATE, APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH .PARAMETER Thresholdvalue Value for the high threshold. The Citrix ADC generates an SNMP trap message when the value of the attribute associated with the alarm is greater than or equal to the specified high threshold value. .PARAMETER Normalvalue Value for the normal threshold. A trap message is generated if the value of the respective attribute falls to or below this value after exceeding the high threshold. .PARAMETER Time Interval, in seconds, at which the Citrix ADC generates SNMP trap messages when the conditions specified in the SNMP alarm are met.Can be specified for the following alarms: SYNFLOOD, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS,HA-BAD-SECONDARY-STATE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-BKHB-FAILED, PORT-ALLOC-FAILED, COMPACT-FLASH-ERRORS, HARD-DISK-DRIVE-ERRORS and APPFW traps. Default trap time intervals: SYNFLOOD and APPFW traps = 1sec, PORT-ALLOC-FAILED = 3600sec(1 hour), Other Traps = 86400sec(1 day). .PARAMETER State Current state of the SNMP alarm. The Citrix ADC generates trap messages only for SNMP alarms that are enabled. Some alarms are enabled by default, but you can disable them. Possible values = ENABLED, DISABLED .PARAMETER Severity Severity level assigned to trap messages generated by this alarm. The severity levels are, in increasing order of severity, Informational, Warning, Minor, Major, and Critical. This parameter is useful when you want the Citrix ADC to send trap messages to a trap listener on the basis of severity level. Trap messages with a severity level lower than the specified level (in the trap listener entry) are not sent. Possible values = Critical, Major, Minor, Warning, Informational .PARAMETER Logging Logging status of the alarm. When logging is enabled, the Citrix ADC logs every trap message that is generated for this alarm. Possible values = ENABLED, DISABLED .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpalarm -trapname <string> An example how to unset snmpalarm configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpalarm Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpalarm Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateSet('CPU-USAGE', 'AVERAGE-CPU', 'MEMORY', 'MGMT-CPU-USAGE', 'SYNFLOOD', 'TCP-SYNFLOOD', 'VSERVER-REQRATE', 'SERVICE-REQRATE', 'ENTITY-RXRATE', 'ENTITY-TXRATE', 'ENTITY-SYNFLOOD', 'SERVICE-MAXCLIENTS', 'HA-STATE-CHANGE', 'ENTITY-STATE', 'CONFIG-CHANGE', 'CONFIG-SAVE', 'SERVICEGROUP-MEMBER-REQRATE', 'SERVICEGROUP-MEMBER-MAXCLIENTS', 'MONITOR-RTO-THRESHOLD', 'LOGIN-FAILURE', 'SSL-CERT-EXPIRY', 'FAN-SPEED-LOW', 'VOLTAGE-LOW', 'VOLTAGE-HIGH', 'TEMPERATURE-HIGH', 'CPU-TEMPERATURE-HIGH', 'POWER-SUPPLY-FAILURE', 'DISK-USAGE-HIGH', 'INTERFACE-THROUGHPUT-LOW', 'MON_PROBE_FAILED', 'HA-VERSION-MISMATCH', 'HA-SYNC-FAILURE', 'HA-NO-HEARTBEATS', 'HA-BAD-SECONDARY-STATE', 'INTERFACE-BW-USAGE', 'RATE-LIMIT-THRESHOLD-EXCEEDED', 'ENTITY-NAME-CHANGE', 'HA-PROP-FAILURE', 'IP-CONFLICT', 'PF-RL-RATE-THRESHOLD', 'PF-RL-PPS-THRESHOLD', 'PF-RL-RATE-PKTS-DROPPED', 'PF-RL-PPS-PKTS-DROPPED', 'APPFW-START-URL', 'APPFW-DENY-URL', 'APPFW-VIOLATIONS-TYPE', 'APPFW-REFERER-HEADER', 'APPFW-CSRF-TAG', 'APPFW-COOKIE', 'APPFW-FIELD-CONSISTENCY', 'APPFW-BUFFER-OVERFLOW', 'APPFW-FIELD-FORMAT', 'APPFW-FILE-UPLOAD-TYPE', 'APPFW-JSON-DOS', 'APPFW-JSON-SQL', 'APPFW-JSON-XSS', 'APPFW-SAFE-COMMERCE', 'APPFW-SAFE-OBJECT', 'APPFW-SESSION-LIMIT', 'APPFW-SIGNATURE-MATCH', 'APPFW-POLICY-HIT', 'APPFW-XSS', 'APPFW-XML-XSS', 'APPFW-SQL', 'APPFW-XML-SQL', 'APPFW-XML-ATTACHMENT', 'APPFW-XML-DOS', 'APPFW-XML-VALIDATION', 'APPFW-XML-WSI', 'APPFW-XML-SCHEMA-COMPILE', 'APPFW-XML-SOAP-FAULT', 'APPFW-NEW-SIGNATURE-ADDED', 'APPFW-DEPLOY-RELAXATION-DP', 'APPFW-LEARNED-RULE-APPLIED-DYN-PROF', 'APPFW-CMD', 'APPFW-POSTBODYLIMIT', 'APPFW-JSON-CMD', 'APPFW-SQL-GRAM', 'APPFW-JSON-SQL-GRAM', 'DNSKEY-EXPIRY', 'HA-LICENSE-MISMATCH', 'SSL-CARD-FAILED', 'SSL-CARD-NORMAL', 'WARM-RESTART-EVENT', 'HARD-DISK-DRIVE-ERRORS', 'COMPACT-FLASH-ERRORS', 'CALLHOME-UPLOAD-EVENT', '1024KEY-EXCHANGE-RATE', '2048KEY-EXCHANGE-RATE', '4096KEY-EXCHANGE-RATE', 'SSL-CUR-SESSION-INUSE', 'CLUSTER-NODE-HEALTH', 'CLUSTER-NODE-QUORUM', 'CLUSTER-VERSION-MISMATCH', 'CLUSTER-CCO-CHANGE', 'CLUSTER-OVS-CHANGE', 'CLUSTER-SYNC-FAILURE', 'CLUSTER-SYNC-PARTIAL-SUCCESS', 'CLUSTER-PROP-FAILURE', 'HA-STICKY-PRIMARY', 'INBAND-PROTOCOL-VERSION-MISMATCH', 'SSL-CHIP-REINIT', 'VRID-STATE-CHANGE', 'PORT-ALLOC-FAILED', 'LLDP-REMOTE-CHANGE', 'DUPLICATE-IPV6', 'PARTITION-CONFIG-EVENT', 'PARTITION-SWITCHED', 'LSN-PORTALLOC-FAILED', 'LSN-PORTQUOTA-EXCEED', 'LSN-SESSIONQUOTA-EXCEED', 'LSN-MEM-RECOVERY-KICKEDIN', 'VSERVER-SPILLOVER', 'PARTITION-RATE-LIMIT', 'POOLED-LICENSE-ONGRACE', 'POOLED-LICENSE-PARTIAL', 'CLUSTER-BACKPLANE-HB-MISSING', 'GSLB-SITE-MEP-FLAP', 'DNS-MAXNEGCACHE-USAGE', 'DNS-MAXCACHE-USAGE', 'NS-LICENSE-EXPIRY', 'PKT-RATELIMITING-ATTACK', 'GSLB-SYNC-STATUS-FLIP', 'URLFILT-DB-UPDATE-STATUS', 'URLFILT-INIT-SDK', 'POOLED-LICENSE-CHECKOUT-FAILURE', 'MIGRATION-STARTED', 'MIGRATION-COMPLETE', 'ECDHE-EXCHANGE-RATE', 'BOT-SIGNATURE-UPDATE', 'APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH')] [string]$Trapname, [Boolean]$thresholdvalue, [Boolean]$normalvalue, [Boolean]$time, [Boolean]$state, [Boolean]$severity, [Boolean]$logging ) begin { Write-Verbose "Invoke-ADCUnsetSnmpalarm: Starting" } process { try { $payload = @{ trapname = $trapname } if ( $PSBoundParameters.ContainsKey('thresholdvalue') ) { $payload.Add('thresholdvalue', $thresholdvalue) } if ( $PSBoundParameters.ContainsKey('normalvalue') ) { $payload.Add('normalvalue', $normalvalue) } if ( $PSBoundParameters.ContainsKey('time') ) { $payload.Add('time', $time) } if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) } if ( $PSBoundParameters.ContainsKey('severity') ) { $payload.Add('severity', $severity) } if ( $PSBoundParameters.ContainsKey('logging') ) { $payload.Add('logging', $logging) } if ( $PSCmdlet.ShouldProcess("$trapname", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpalarm -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpalarm: Finished" } } function Invoke-ADCEnableSnmpalarm { <# .SYNOPSIS Enable SNMP configuration Object. .DESCRIPTION Configuration for alarm resource. .PARAMETER Trapname Name of the SNMP alarm. This parameter is required for identifying the SNMP alarm and cannot be modified. Possible values = CPU-USAGE, AVERAGE-CPU, MEMORY, MGMT-CPU-USAGE, SYNFLOOD, TCP-SYNFLOOD, VSERVER-REQRATE, SERVICE-REQRATE, ENTITY-RXRATE, ENTITY-TXRATE, ENTITY-SYNFLOOD, SERVICE-MAXCLIENTS, HA-STATE-CHANGE, ENTITY-STATE, CONFIG-CHANGE, CONFIG-SAVE, SERVICEGROUP-MEMBER-REQRATE, SERVICEGROUP-MEMBER-MAXCLIENTS, MONITOR-RTO-THRESHOLD, LOGIN-FAILURE, SSL-CERT-EXPIRY, FAN-SPEED-LOW, VOLTAGE-LOW, VOLTAGE-HIGH, TEMPERATURE-HIGH, CPU-TEMPERATURE-HIGH, POWER-SUPPLY-FAILURE, DISK-USAGE-HIGH, INTERFACE-THROUGHPUT-LOW, MON_PROBE_FAILED, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS, HA-BAD-SECONDARY-STATE, INTERFACE-BW-USAGE, RATE-LIMIT-THRESHOLD-EXCEEDED, ENTITY-NAME-CHANGE, HA-PROP-FAILURE, IP-CONFLICT, PF-RL-RATE-THRESHOLD, PF-RL-PPS-THRESHOLD, PF-RL-RATE-PKTS-DROPPED, PF-RL-PPS-PKTS-DROPPED, APPFW-START-URL, APPFW-DENY-URL, APPFW-VIOLATIONS-TYPE, APPFW-REFERER-HEADER, APPFW-CSRF-TAG, APPFW-COOKIE, APPFW-FIELD-CONSISTENCY, APPFW-BUFFER-OVERFLOW, APPFW-FIELD-FORMAT, APPFW-FILE-UPLOAD-TYPE, APPFW-JSON-DOS, APPFW-JSON-SQL, APPFW-JSON-XSS, APPFW-SAFE-COMMERCE, APPFW-SAFE-OBJECT, APPFW-SESSION-LIMIT, APPFW-SIGNATURE-MATCH, APPFW-POLICY-HIT, APPFW-XSS, APPFW-XML-XSS, APPFW-SQL, APPFW-XML-SQL, APPFW-XML-ATTACHMENT, APPFW-XML-DOS, APPFW-XML-VALIDATION, APPFW-XML-WSI, APPFW-XML-SCHEMA-COMPILE, APPFW-XML-SOAP-FAULT, APPFW-NEW-SIGNATURE-ADDED, APPFW-DEPLOY-RELAXATION-DP, APPFW-LEARNED-RULE-APPLIED-DYN-PROF, APPFW-CMD, APPFW-POSTBODYLIMIT, APPFW-JSON-CMD, APPFW-SQL-GRAM, APPFW-JSON-SQL-GRAM, DNSKEY-EXPIRY, HA-LICENSE-MISMATCH, SSL-CARD-FAILED, SSL-CARD-NORMAL, WARM-RESTART-EVENT, HARD-DISK-DRIVE-ERRORS, COMPACT-FLASH-ERRORS, CALLHOME-UPLOAD-EVENT, 1024KEY-EXCHANGE-RATE, 2048KEY-EXCHANGE-RATE, 4096KEY-EXCHANGE-RATE, SSL-CUR-SESSION-INUSE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-CCO-CHANGE, CLUSTER-OVS-CHANGE, CLUSTER-SYNC-FAILURE, CLUSTER-SYNC-PARTIAL-SUCCESS, CLUSTER-PROP-FAILURE, HA-STICKY-PRIMARY, INBAND-PROTOCOL-VERSION-MISMATCH, SSL-CHIP-REINIT, VRID-STATE-CHANGE, PORT-ALLOC-FAILED, LLDP-REMOTE-CHANGE, DUPLICATE-IPV6, PARTITION-CONFIG-EVENT, PARTITION-SWITCHED, LSN-PORTALLOC-FAILED, LSN-PORTQUOTA-EXCEED, LSN-SESSIONQUOTA-EXCEED, LSN-MEM-RECOVERY-KICKEDIN, VSERVER-SPILLOVER, PARTITION-RATE-LIMIT, POOLED-LICENSE-ONGRACE, POOLED-LICENSE-PARTIAL, CLUSTER-BACKPLANE-HB-MISSING, GSLB-SITE-MEP-FLAP, DNS-MAXNEGCACHE-USAGE, DNS-MAXCACHE-USAGE, NS-LICENSE-EXPIRY, PKT-RATELIMITING-ATTACK, GSLB-SYNC-STATUS-FLIP, URLFILT-DB-UPDATE-STATUS, URLFILT-INIT-SDK, POOLED-LICENSE-CHECKOUT-FAILURE, MIGRATION-STARTED, MIGRATION-COMPLETE, ECDHE-EXCHANGE-RATE, BOT-SIGNATURE-UPDATE, APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH .EXAMPLE PS C:\>Invoke-ADCEnableSnmpalarm -trapname <string> An example how to enable snmpalarm configuration Object(s). .NOTES File Name : Invoke-ADCEnableSnmpalarm Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpalarm/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('CPU-USAGE', 'AVERAGE-CPU', 'MEMORY', 'MGMT-CPU-USAGE', 'SYNFLOOD', 'TCP-SYNFLOOD', 'VSERVER-REQRATE', 'SERVICE-REQRATE', 'ENTITY-RXRATE', 'ENTITY-TXRATE', 'ENTITY-SYNFLOOD', 'SERVICE-MAXCLIENTS', 'HA-STATE-CHANGE', 'ENTITY-STATE', 'CONFIG-CHANGE', 'CONFIG-SAVE', 'SERVICEGROUP-MEMBER-REQRATE', 'SERVICEGROUP-MEMBER-MAXCLIENTS', 'MONITOR-RTO-THRESHOLD', 'LOGIN-FAILURE', 'SSL-CERT-EXPIRY', 'FAN-SPEED-LOW', 'VOLTAGE-LOW', 'VOLTAGE-HIGH', 'TEMPERATURE-HIGH', 'CPU-TEMPERATURE-HIGH', 'POWER-SUPPLY-FAILURE', 'DISK-USAGE-HIGH', 'INTERFACE-THROUGHPUT-LOW', 'MON_PROBE_FAILED', 'HA-VERSION-MISMATCH', 'HA-SYNC-FAILURE', 'HA-NO-HEARTBEATS', 'HA-BAD-SECONDARY-STATE', 'INTERFACE-BW-USAGE', 'RATE-LIMIT-THRESHOLD-EXCEEDED', 'ENTITY-NAME-CHANGE', 'HA-PROP-FAILURE', 'IP-CONFLICT', 'PF-RL-RATE-THRESHOLD', 'PF-RL-PPS-THRESHOLD', 'PF-RL-RATE-PKTS-DROPPED', 'PF-RL-PPS-PKTS-DROPPED', 'APPFW-START-URL', 'APPFW-DENY-URL', 'APPFW-VIOLATIONS-TYPE', 'APPFW-REFERER-HEADER', 'APPFW-CSRF-TAG', 'APPFW-COOKIE', 'APPFW-FIELD-CONSISTENCY', 'APPFW-BUFFER-OVERFLOW', 'APPFW-FIELD-FORMAT', 'APPFW-FILE-UPLOAD-TYPE', 'APPFW-JSON-DOS', 'APPFW-JSON-SQL', 'APPFW-JSON-XSS', 'APPFW-SAFE-COMMERCE', 'APPFW-SAFE-OBJECT', 'APPFW-SESSION-LIMIT', 'APPFW-SIGNATURE-MATCH', 'APPFW-POLICY-HIT', 'APPFW-XSS', 'APPFW-XML-XSS', 'APPFW-SQL', 'APPFW-XML-SQL', 'APPFW-XML-ATTACHMENT', 'APPFW-XML-DOS', 'APPFW-XML-VALIDATION', 'APPFW-XML-WSI', 'APPFW-XML-SCHEMA-COMPILE', 'APPFW-XML-SOAP-FAULT', 'APPFW-NEW-SIGNATURE-ADDED', 'APPFW-DEPLOY-RELAXATION-DP', 'APPFW-LEARNED-RULE-APPLIED-DYN-PROF', 'APPFW-CMD', 'APPFW-POSTBODYLIMIT', 'APPFW-JSON-CMD', 'APPFW-SQL-GRAM', 'APPFW-JSON-SQL-GRAM', 'DNSKEY-EXPIRY', 'HA-LICENSE-MISMATCH', 'SSL-CARD-FAILED', 'SSL-CARD-NORMAL', 'WARM-RESTART-EVENT', 'HARD-DISK-DRIVE-ERRORS', 'COMPACT-FLASH-ERRORS', 'CALLHOME-UPLOAD-EVENT', '1024KEY-EXCHANGE-RATE', '2048KEY-EXCHANGE-RATE', '4096KEY-EXCHANGE-RATE', 'SSL-CUR-SESSION-INUSE', 'CLUSTER-NODE-HEALTH', 'CLUSTER-NODE-QUORUM', 'CLUSTER-VERSION-MISMATCH', 'CLUSTER-CCO-CHANGE', 'CLUSTER-OVS-CHANGE', 'CLUSTER-SYNC-FAILURE', 'CLUSTER-SYNC-PARTIAL-SUCCESS', 'CLUSTER-PROP-FAILURE', 'HA-STICKY-PRIMARY', 'INBAND-PROTOCOL-VERSION-MISMATCH', 'SSL-CHIP-REINIT', 'VRID-STATE-CHANGE', 'PORT-ALLOC-FAILED', 'LLDP-REMOTE-CHANGE', 'DUPLICATE-IPV6', 'PARTITION-CONFIG-EVENT', 'PARTITION-SWITCHED', 'LSN-PORTALLOC-FAILED', 'LSN-PORTQUOTA-EXCEED', 'LSN-SESSIONQUOTA-EXCEED', 'LSN-MEM-RECOVERY-KICKEDIN', 'VSERVER-SPILLOVER', 'PARTITION-RATE-LIMIT', 'POOLED-LICENSE-ONGRACE', 'POOLED-LICENSE-PARTIAL', 'CLUSTER-BACKPLANE-HB-MISSING', 'GSLB-SITE-MEP-FLAP', 'DNS-MAXNEGCACHE-USAGE', 'DNS-MAXCACHE-USAGE', 'NS-LICENSE-EXPIRY', 'PKT-RATELIMITING-ATTACK', 'GSLB-SYNC-STATUS-FLIP', 'URLFILT-DB-UPDATE-STATUS', 'URLFILT-INIT-SDK', 'POOLED-LICENSE-CHECKOUT-FAILURE', 'MIGRATION-STARTED', 'MIGRATION-COMPLETE', 'ECDHE-EXCHANGE-RATE', 'BOT-SIGNATURE-UPDATE', 'APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH')] [string]$Trapname ) begin { Write-Verbose "Invoke-ADCEnableSnmpalarm: Starting" } process { try { $payload = @{ trapname = $trapname } if ( $PSCmdlet.ShouldProcess($Name, "Enable SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpalarm -Action enable -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCEnableSnmpalarm: Finished" } } function Invoke-ADCDisableSnmpalarm { <# .SYNOPSIS Disable SNMP configuration Object. .DESCRIPTION Configuration for alarm resource. .PARAMETER Trapname Name of the SNMP alarm. This parameter is required for identifying the SNMP alarm and cannot be modified. Possible values = CPU-USAGE, AVERAGE-CPU, MEMORY, MGMT-CPU-USAGE, SYNFLOOD, TCP-SYNFLOOD, VSERVER-REQRATE, SERVICE-REQRATE, ENTITY-RXRATE, ENTITY-TXRATE, ENTITY-SYNFLOOD, SERVICE-MAXCLIENTS, HA-STATE-CHANGE, ENTITY-STATE, CONFIG-CHANGE, CONFIG-SAVE, SERVICEGROUP-MEMBER-REQRATE, SERVICEGROUP-MEMBER-MAXCLIENTS, MONITOR-RTO-THRESHOLD, LOGIN-FAILURE, SSL-CERT-EXPIRY, FAN-SPEED-LOW, VOLTAGE-LOW, VOLTAGE-HIGH, TEMPERATURE-HIGH, CPU-TEMPERATURE-HIGH, POWER-SUPPLY-FAILURE, DISK-USAGE-HIGH, INTERFACE-THROUGHPUT-LOW, MON_PROBE_FAILED, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS, HA-BAD-SECONDARY-STATE, INTERFACE-BW-USAGE, RATE-LIMIT-THRESHOLD-EXCEEDED, ENTITY-NAME-CHANGE, HA-PROP-FAILURE, IP-CONFLICT, PF-RL-RATE-THRESHOLD, PF-RL-PPS-THRESHOLD, PF-RL-RATE-PKTS-DROPPED, PF-RL-PPS-PKTS-DROPPED, APPFW-START-URL, APPFW-DENY-URL, APPFW-VIOLATIONS-TYPE, APPFW-REFERER-HEADER, APPFW-CSRF-TAG, APPFW-COOKIE, APPFW-FIELD-CONSISTENCY, APPFW-BUFFER-OVERFLOW, APPFW-FIELD-FORMAT, APPFW-FILE-UPLOAD-TYPE, APPFW-JSON-DOS, APPFW-JSON-SQL, APPFW-JSON-XSS, APPFW-SAFE-COMMERCE, APPFW-SAFE-OBJECT, APPFW-SESSION-LIMIT, APPFW-SIGNATURE-MATCH, APPFW-POLICY-HIT, APPFW-XSS, APPFW-XML-XSS, APPFW-SQL, APPFW-XML-SQL, APPFW-XML-ATTACHMENT, APPFW-XML-DOS, APPFW-XML-VALIDATION, APPFW-XML-WSI, APPFW-XML-SCHEMA-COMPILE, APPFW-XML-SOAP-FAULT, APPFW-NEW-SIGNATURE-ADDED, APPFW-DEPLOY-RELAXATION-DP, APPFW-LEARNED-RULE-APPLIED-DYN-PROF, APPFW-CMD, APPFW-POSTBODYLIMIT, APPFW-JSON-CMD, APPFW-SQL-GRAM, APPFW-JSON-SQL-GRAM, DNSKEY-EXPIRY, HA-LICENSE-MISMATCH, SSL-CARD-FAILED, SSL-CARD-NORMAL, WARM-RESTART-EVENT, HARD-DISK-DRIVE-ERRORS, COMPACT-FLASH-ERRORS, CALLHOME-UPLOAD-EVENT, 1024KEY-EXCHANGE-RATE, 2048KEY-EXCHANGE-RATE, 4096KEY-EXCHANGE-RATE, SSL-CUR-SESSION-INUSE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-CCO-CHANGE, CLUSTER-OVS-CHANGE, CLUSTER-SYNC-FAILURE, CLUSTER-SYNC-PARTIAL-SUCCESS, CLUSTER-PROP-FAILURE, HA-STICKY-PRIMARY, INBAND-PROTOCOL-VERSION-MISMATCH, SSL-CHIP-REINIT, VRID-STATE-CHANGE, PORT-ALLOC-FAILED, LLDP-REMOTE-CHANGE, DUPLICATE-IPV6, PARTITION-CONFIG-EVENT, PARTITION-SWITCHED, LSN-PORTALLOC-FAILED, LSN-PORTQUOTA-EXCEED, LSN-SESSIONQUOTA-EXCEED, LSN-MEM-RECOVERY-KICKEDIN, VSERVER-SPILLOVER, PARTITION-RATE-LIMIT, POOLED-LICENSE-ONGRACE, POOLED-LICENSE-PARTIAL, CLUSTER-BACKPLANE-HB-MISSING, GSLB-SITE-MEP-FLAP, DNS-MAXNEGCACHE-USAGE, DNS-MAXCACHE-USAGE, NS-LICENSE-EXPIRY, PKT-RATELIMITING-ATTACK, GSLB-SYNC-STATUS-FLIP, URLFILT-DB-UPDATE-STATUS, URLFILT-INIT-SDK, POOLED-LICENSE-CHECKOUT-FAILURE, MIGRATION-STARTED, MIGRATION-COMPLETE, ECDHE-EXCHANGE-RATE, BOT-SIGNATURE-UPDATE, APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH .EXAMPLE PS C:\>Invoke-ADCDisableSnmpalarm -trapname <string> An example how to disable snmpalarm configuration Object(s). .NOTES File Name : Invoke-ADCDisableSnmpalarm Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpalarm/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('CPU-USAGE', 'AVERAGE-CPU', 'MEMORY', 'MGMT-CPU-USAGE', 'SYNFLOOD', 'TCP-SYNFLOOD', 'VSERVER-REQRATE', 'SERVICE-REQRATE', 'ENTITY-RXRATE', 'ENTITY-TXRATE', 'ENTITY-SYNFLOOD', 'SERVICE-MAXCLIENTS', 'HA-STATE-CHANGE', 'ENTITY-STATE', 'CONFIG-CHANGE', 'CONFIG-SAVE', 'SERVICEGROUP-MEMBER-REQRATE', 'SERVICEGROUP-MEMBER-MAXCLIENTS', 'MONITOR-RTO-THRESHOLD', 'LOGIN-FAILURE', 'SSL-CERT-EXPIRY', 'FAN-SPEED-LOW', 'VOLTAGE-LOW', 'VOLTAGE-HIGH', 'TEMPERATURE-HIGH', 'CPU-TEMPERATURE-HIGH', 'POWER-SUPPLY-FAILURE', 'DISK-USAGE-HIGH', 'INTERFACE-THROUGHPUT-LOW', 'MON_PROBE_FAILED', 'HA-VERSION-MISMATCH', 'HA-SYNC-FAILURE', 'HA-NO-HEARTBEATS', 'HA-BAD-SECONDARY-STATE', 'INTERFACE-BW-USAGE', 'RATE-LIMIT-THRESHOLD-EXCEEDED', 'ENTITY-NAME-CHANGE', 'HA-PROP-FAILURE', 'IP-CONFLICT', 'PF-RL-RATE-THRESHOLD', 'PF-RL-PPS-THRESHOLD', 'PF-RL-RATE-PKTS-DROPPED', 'PF-RL-PPS-PKTS-DROPPED', 'APPFW-START-URL', 'APPFW-DENY-URL', 'APPFW-VIOLATIONS-TYPE', 'APPFW-REFERER-HEADER', 'APPFW-CSRF-TAG', 'APPFW-COOKIE', 'APPFW-FIELD-CONSISTENCY', 'APPFW-BUFFER-OVERFLOW', 'APPFW-FIELD-FORMAT', 'APPFW-FILE-UPLOAD-TYPE', 'APPFW-JSON-DOS', 'APPFW-JSON-SQL', 'APPFW-JSON-XSS', 'APPFW-SAFE-COMMERCE', 'APPFW-SAFE-OBJECT', 'APPFW-SESSION-LIMIT', 'APPFW-SIGNATURE-MATCH', 'APPFW-POLICY-HIT', 'APPFW-XSS', 'APPFW-XML-XSS', 'APPFW-SQL', 'APPFW-XML-SQL', 'APPFW-XML-ATTACHMENT', 'APPFW-XML-DOS', 'APPFW-XML-VALIDATION', 'APPFW-XML-WSI', 'APPFW-XML-SCHEMA-COMPILE', 'APPFW-XML-SOAP-FAULT', 'APPFW-NEW-SIGNATURE-ADDED', 'APPFW-DEPLOY-RELAXATION-DP', 'APPFW-LEARNED-RULE-APPLIED-DYN-PROF', 'APPFW-CMD', 'APPFW-POSTBODYLIMIT', 'APPFW-JSON-CMD', 'APPFW-SQL-GRAM', 'APPFW-JSON-SQL-GRAM', 'DNSKEY-EXPIRY', 'HA-LICENSE-MISMATCH', 'SSL-CARD-FAILED', 'SSL-CARD-NORMAL', 'WARM-RESTART-EVENT', 'HARD-DISK-DRIVE-ERRORS', 'COMPACT-FLASH-ERRORS', 'CALLHOME-UPLOAD-EVENT', '1024KEY-EXCHANGE-RATE', '2048KEY-EXCHANGE-RATE', '4096KEY-EXCHANGE-RATE', 'SSL-CUR-SESSION-INUSE', 'CLUSTER-NODE-HEALTH', 'CLUSTER-NODE-QUORUM', 'CLUSTER-VERSION-MISMATCH', 'CLUSTER-CCO-CHANGE', 'CLUSTER-OVS-CHANGE', 'CLUSTER-SYNC-FAILURE', 'CLUSTER-SYNC-PARTIAL-SUCCESS', 'CLUSTER-PROP-FAILURE', 'HA-STICKY-PRIMARY', 'INBAND-PROTOCOL-VERSION-MISMATCH', 'SSL-CHIP-REINIT', 'VRID-STATE-CHANGE', 'PORT-ALLOC-FAILED', 'LLDP-REMOTE-CHANGE', 'DUPLICATE-IPV6', 'PARTITION-CONFIG-EVENT', 'PARTITION-SWITCHED', 'LSN-PORTALLOC-FAILED', 'LSN-PORTQUOTA-EXCEED', 'LSN-SESSIONQUOTA-EXCEED', 'LSN-MEM-RECOVERY-KICKEDIN', 'VSERVER-SPILLOVER', 'PARTITION-RATE-LIMIT', 'POOLED-LICENSE-ONGRACE', 'POOLED-LICENSE-PARTIAL', 'CLUSTER-BACKPLANE-HB-MISSING', 'GSLB-SITE-MEP-FLAP', 'DNS-MAXNEGCACHE-USAGE', 'DNS-MAXCACHE-USAGE', 'NS-LICENSE-EXPIRY', 'PKT-RATELIMITING-ATTACK', 'GSLB-SYNC-STATUS-FLIP', 'URLFILT-DB-UPDATE-STATUS', 'URLFILT-INIT-SDK', 'POOLED-LICENSE-CHECKOUT-FAILURE', 'MIGRATION-STARTED', 'MIGRATION-COMPLETE', 'ECDHE-EXCHANGE-RATE', 'BOT-SIGNATURE-UPDATE', 'APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH')] [string]$Trapname ) begin { Write-Verbose "Invoke-ADCDisableSnmpalarm: Starting" } process { try { $payload = @{ trapname = $trapname } if ( $PSCmdlet.ShouldProcess($Name, "Disable SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpalarm -Action disable -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDisableSnmpalarm: Finished" } } function Invoke-ADCGetSnmpalarm { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for alarm resource. .PARAMETER Trapname Name of the SNMP alarm. This parameter is required for identifying the SNMP alarm and cannot be modified. Possible values = CPU-USAGE, AVERAGE-CPU, MEMORY, MGMT-CPU-USAGE, SYNFLOOD, TCP-SYNFLOOD, VSERVER-REQRATE, SERVICE-REQRATE, ENTITY-RXRATE, ENTITY-TXRATE, ENTITY-SYNFLOOD, SERVICE-MAXCLIENTS, HA-STATE-CHANGE, ENTITY-STATE, CONFIG-CHANGE, CONFIG-SAVE, SERVICEGROUP-MEMBER-REQRATE, SERVICEGROUP-MEMBER-MAXCLIENTS, MONITOR-RTO-THRESHOLD, LOGIN-FAILURE, SSL-CERT-EXPIRY, FAN-SPEED-LOW, VOLTAGE-LOW, VOLTAGE-HIGH, TEMPERATURE-HIGH, CPU-TEMPERATURE-HIGH, POWER-SUPPLY-FAILURE, DISK-USAGE-HIGH, INTERFACE-THROUGHPUT-LOW, MON_PROBE_FAILED, HA-VERSION-MISMATCH, HA-SYNC-FAILURE, HA-NO-HEARTBEATS, HA-BAD-SECONDARY-STATE, INTERFACE-BW-USAGE, RATE-LIMIT-THRESHOLD-EXCEEDED, ENTITY-NAME-CHANGE, HA-PROP-FAILURE, IP-CONFLICT, PF-RL-RATE-THRESHOLD, PF-RL-PPS-THRESHOLD, PF-RL-RATE-PKTS-DROPPED, PF-RL-PPS-PKTS-DROPPED, APPFW-START-URL, APPFW-DENY-URL, APPFW-VIOLATIONS-TYPE, APPFW-REFERER-HEADER, APPFW-CSRF-TAG, APPFW-COOKIE, APPFW-FIELD-CONSISTENCY, APPFW-BUFFER-OVERFLOW, APPFW-FIELD-FORMAT, APPFW-FILE-UPLOAD-TYPE, APPFW-JSON-DOS, APPFW-JSON-SQL, APPFW-JSON-XSS, APPFW-SAFE-COMMERCE, APPFW-SAFE-OBJECT, APPFW-SESSION-LIMIT, APPFW-SIGNATURE-MATCH, APPFW-POLICY-HIT, APPFW-XSS, APPFW-XML-XSS, APPFW-SQL, APPFW-XML-SQL, APPFW-XML-ATTACHMENT, APPFW-XML-DOS, APPFW-XML-VALIDATION, APPFW-XML-WSI, APPFW-XML-SCHEMA-COMPILE, APPFW-XML-SOAP-FAULT, APPFW-NEW-SIGNATURE-ADDED, APPFW-DEPLOY-RELAXATION-DP, APPFW-LEARNED-RULE-APPLIED-DYN-PROF, APPFW-CMD, APPFW-POSTBODYLIMIT, APPFW-JSON-CMD, APPFW-SQL-GRAM, APPFW-JSON-SQL-GRAM, DNSKEY-EXPIRY, HA-LICENSE-MISMATCH, SSL-CARD-FAILED, SSL-CARD-NORMAL, WARM-RESTART-EVENT, HARD-DISK-DRIVE-ERRORS, COMPACT-FLASH-ERRORS, CALLHOME-UPLOAD-EVENT, 1024KEY-EXCHANGE-RATE, 2048KEY-EXCHANGE-RATE, 4096KEY-EXCHANGE-RATE, SSL-CUR-SESSION-INUSE, CLUSTER-NODE-HEALTH, CLUSTER-NODE-QUORUM, CLUSTER-VERSION-MISMATCH, CLUSTER-CCO-CHANGE, CLUSTER-OVS-CHANGE, CLUSTER-SYNC-FAILURE, CLUSTER-SYNC-PARTIAL-SUCCESS, CLUSTER-PROP-FAILURE, HA-STICKY-PRIMARY, INBAND-PROTOCOL-VERSION-MISMATCH, SSL-CHIP-REINIT, VRID-STATE-CHANGE, PORT-ALLOC-FAILED, LLDP-REMOTE-CHANGE, DUPLICATE-IPV6, PARTITION-CONFIG-EVENT, PARTITION-SWITCHED, LSN-PORTALLOC-FAILED, LSN-PORTQUOTA-EXCEED, LSN-SESSIONQUOTA-EXCEED, LSN-MEM-RECOVERY-KICKEDIN, VSERVER-SPILLOVER, PARTITION-RATE-LIMIT, POOLED-LICENSE-ONGRACE, POOLED-LICENSE-PARTIAL, CLUSTER-BACKPLANE-HB-MISSING, GSLB-SITE-MEP-FLAP, DNS-MAXNEGCACHE-USAGE, DNS-MAXCACHE-USAGE, NS-LICENSE-EXPIRY, PKT-RATELIMITING-ATTACK, GSLB-SYNC-STATUS-FLIP, URLFILT-DB-UPDATE-STATUS, URLFILT-INIT-SDK, POOLED-LICENSE-CHECKOUT-FAILURE, MIGRATION-STARTED, MIGRATION-COMPLETE, ECDHE-EXCHANGE-RATE, BOT-SIGNATURE-UPDATE, APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH .PARAMETER GetAll Retrieve all snmpalarm object(s). .PARAMETER Count If specified, the count of the snmpalarm object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpalarm Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpalarm -GetAll Get all snmpalarm data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpalarm -Count Get the number of snmpalarm objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpalarm -name <string> Get snmpalarm object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpalarm -Filter @{ 'name'='<value>' } Get snmpalarm data with a filter. .NOTES File Name : Invoke-ADCGetSnmpalarm Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpalarm/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateSet('CPU-USAGE', 'AVERAGE-CPU', 'MEMORY', 'MGMT-CPU-USAGE', 'SYNFLOOD', 'TCP-SYNFLOOD', 'VSERVER-REQRATE', 'SERVICE-REQRATE', 'ENTITY-RXRATE', 'ENTITY-TXRATE', 'ENTITY-SYNFLOOD', 'SERVICE-MAXCLIENTS', 'HA-STATE-CHANGE', 'ENTITY-STATE', 'CONFIG-CHANGE', 'CONFIG-SAVE', 'SERVICEGROUP-MEMBER-REQRATE', 'SERVICEGROUP-MEMBER-MAXCLIENTS', 'MONITOR-RTO-THRESHOLD', 'LOGIN-FAILURE', 'SSL-CERT-EXPIRY', 'FAN-SPEED-LOW', 'VOLTAGE-LOW', 'VOLTAGE-HIGH', 'TEMPERATURE-HIGH', 'CPU-TEMPERATURE-HIGH', 'POWER-SUPPLY-FAILURE', 'DISK-USAGE-HIGH', 'INTERFACE-THROUGHPUT-LOW', 'MON_PROBE_FAILED', 'HA-VERSION-MISMATCH', 'HA-SYNC-FAILURE', 'HA-NO-HEARTBEATS', 'HA-BAD-SECONDARY-STATE', 'INTERFACE-BW-USAGE', 'RATE-LIMIT-THRESHOLD-EXCEEDED', 'ENTITY-NAME-CHANGE', 'HA-PROP-FAILURE', 'IP-CONFLICT', 'PF-RL-RATE-THRESHOLD', 'PF-RL-PPS-THRESHOLD', 'PF-RL-RATE-PKTS-DROPPED', 'PF-RL-PPS-PKTS-DROPPED', 'APPFW-START-URL', 'APPFW-DENY-URL', 'APPFW-VIOLATIONS-TYPE', 'APPFW-REFERER-HEADER', 'APPFW-CSRF-TAG', 'APPFW-COOKIE', 'APPFW-FIELD-CONSISTENCY', 'APPFW-BUFFER-OVERFLOW', 'APPFW-FIELD-FORMAT', 'APPFW-FILE-UPLOAD-TYPE', 'APPFW-JSON-DOS', 'APPFW-JSON-SQL', 'APPFW-JSON-XSS', 'APPFW-SAFE-COMMERCE', 'APPFW-SAFE-OBJECT', 'APPFW-SESSION-LIMIT', 'APPFW-SIGNATURE-MATCH', 'APPFW-POLICY-HIT', 'APPFW-XSS', 'APPFW-XML-XSS', 'APPFW-SQL', 'APPFW-XML-SQL', 'APPFW-XML-ATTACHMENT', 'APPFW-XML-DOS', 'APPFW-XML-VALIDATION', 'APPFW-XML-WSI', 'APPFW-XML-SCHEMA-COMPILE', 'APPFW-XML-SOAP-FAULT', 'APPFW-NEW-SIGNATURE-ADDED', 'APPFW-DEPLOY-RELAXATION-DP', 'APPFW-LEARNED-RULE-APPLIED-DYN-PROF', 'APPFW-CMD', 'APPFW-POSTBODYLIMIT', 'APPFW-JSON-CMD', 'APPFW-SQL-GRAM', 'APPFW-JSON-SQL-GRAM', 'DNSKEY-EXPIRY', 'HA-LICENSE-MISMATCH', 'SSL-CARD-FAILED', 'SSL-CARD-NORMAL', 'WARM-RESTART-EVENT', 'HARD-DISK-DRIVE-ERRORS', 'COMPACT-FLASH-ERRORS', 'CALLHOME-UPLOAD-EVENT', '1024KEY-EXCHANGE-RATE', '2048KEY-EXCHANGE-RATE', '4096KEY-EXCHANGE-RATE', 'SSL-CUR-SESSION-INUSE', 'CLUSTER-NODE-HEALTH', 'CLUSTER-NODE-QUORUM', 'CLUSTER-VERSION-MISMATCH', 'CLUSTER-CCO-CHANGE', 'CLUSTER-OVS-CHANGE', 'CLUSTER-SYNC-FAILURE', 'CLUSTER-SYNC-PARTIAL-SUCCESS', 'CLUSTER-PROP-FAILURE', 'HA-STICKY-PRIMARY', 'INBAND-PROTOCOL-VERSION-MISMATCH', 'SSL-CHIP-REINIT', 'VRID-STATE-CHANGE', 'PORT-ALLOC-FAILED', 'LLDP-REMOTE-CHANGE', 'DUPLICATE-IPV6', 'PARTITION-CONFIG-EVENT', 'PARTITION-SWITCHED', 'LSN-PORTALLOC-FAILED', 'LSN-PORTQUOTA-EXCEED', 'LSN-SESSIONQUOTA-EXCEED', 'LSN-MEM-RECOVERY-KICKEDIN', 'VSERVER-SPILLOVER', 'PARTITION-RATE-LIMIT', 'POOLED-LICENSE-ONGRACE', 'POOLED-LICENSE-PARTIAL', 'CLUSTER-BACKPLANE-HB-MISSING', 'GSLB-SITE-MEP-FLAP', 'DNS-MAXNEGCACHE-USAGE', 'DNS-MAXCACHE-USAGE', 'NS-LICENSE-EXPIRY', 'PKT-RATELIMITING-ATTACK', 'GSLB-SYNC-STATUS-FLIP', 'URLFILT-DB-UPDATE-STATUS', 'URLFILT-INIT-SDK', 'POOLED-LICENSE-CHECKOUT-FAILURE', 'MIGRATION-STARTED', 'MIGRATION-COMPLETE', 'ECDHE-EXCHANGE-RATE', 'BOT-SIGNATURE-UPDATE', 'APPFW-XMLPAYLOAD-CONTENT-TYPE-MISMATCH')] [string]$Trapname, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpalarm: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpalarm objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpalarm -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpalarm objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpalarm -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpalarm objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpalarm -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpalarm configuration for property 'trapname'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpalarm -NitroPath nitro/v1/config -Resource $trapname -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving snmpalarm configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpalarm -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpalarm: Ended" } } function Invoke-ADCAddSnmpcommunity { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for community resource. .PARAMETER Communityname The SNMP community string. Can consist of 1 to 31 characters that include uppercase and lowercase letters,numbers and special characters. .PARAMETER Permissions The SNMP V1 or V2 query-type privilege that you want to associate with this SNMP community. Possible values = GET, GET_NEXT, GET_BULK, SET, ALL .PARAMETER PassThru Return details about the created snmpcommunity item. .EXAMPLE PS C:\>Invoke-ADCAddSnmpcommunity -communityname <string> -permissions <string> An example how to add snmpcommunity configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmpcommunity Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpcommunity/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Communityname, [Parameter(Mandatory)] [ValidateSet('GET', 'GET_NEXT', 'GET_BULK', 'SET', 'ALL')] [string]$Permissions, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCAddSnmpcommunity: Starting" } process { try { $payload = @{ communityname = $communityname permissions = $permissions } if ( $PSCmdlet.ShouldProcess("snmpcommunity", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpcommunity -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpcommunity -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmpcommunity: Finished" } } function Invoke-ADCDeleteSnmpcommunity { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for community resource. .PARAMETER Communityname The SNMP community string. Can consist of 1 to 31 characters that include uppercase and lowercase letters,numbers and special characters. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmpcommunity -Communityname <string> An example how to delete snmpcommunity configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmpcommunity Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpcommunity/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Communityname ) begin { Write-Verbose "Invoke-ADCDeleteSnmpcommunity: Starting" } process { try { $arguments = @{ } if ( $PSCmdlet.ShouldProcess("$communityname", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmpcommunity -NitroPath nitro/v1/config -Resource $communityname -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmpcommunity: Finished" } } function Invoke-ADCGetSnmpcommunity { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for community resource. .PARAMETER Communityname The SNMP community string. Can consist of 1 to 31 characters that include uppercase and lowercase letters,numbers and special characters. .PARAMETER GetAll Retrieve all snmpcommunity object(s). .PARAMETER Count If specified, the count of the snmpcommunity object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpcommunity Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpcommunity -GetAll Get all snmpcommunity data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpcommunity -Count Get the number of snmpcommunity objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpcommunity -name <string> Get snmpcommunity object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpcommunity -Filter @{ 'name'='<value>' } Get snmpcommunity data with a filter. .NOTES File Name : Invoke-ADCGetSnmpcommunity Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpcommunity/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateScript({ $_.Length -gt 1 })] [string]$Communityname, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpcommunity: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpcommunity objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpcommunity -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpcommunity objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpcommunity -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpcommunity objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpcommunity -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpcommunity configuration for property 'communityname'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpcommunity -NitroPath nitro/v1/config -Resource $communityname -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving snmpcommunity configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpcommunity -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpcommunity: Ended" } } function Invoke-ADCUpdateSnmpengineid { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for SNMP engine id resource. .PARAMETER Engineid A hexadecimal value of at least 10 characters, uniquely identifying the engineid. .PARAMETER Ownernode ID of the cluster node for which you are setting the engineid. .PARAMETER PassThru Return details about the created snmpengineid item. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpengineid -engineid <string> An example how to update snmpengineid configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpengineid Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpengineid/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateLength(10, 31)] [string]$Engineid, [ValidateRange(0, 31)] [double]$Ownernode, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCUpdateSnmpengineid: Starting" } process { try { $payload = @{ engineid = $engineid } if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) } if ( $PSCmdlet.ShouldProcess("snmpengineid", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpengineid -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpengineid -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpengineid: Finished" } } function Invoke-ADCUnsetSnmpengineid { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for SNMP engine id resource. .PARAMETER Ownernode ID of the cluster node for which you are setting the engineid. .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpengineid An example how to unset snmpengineid configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpengineid Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpengineid Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Boolean]$ownernode ) begin { Write-Verbose "Invoke-ADCUnsetSnmpengineid: Starting" } process { try { $payload = @{ } if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) } if ( $PSCmdlet.ShouldProcess("snmpengineid", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpengineid -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpengineid: Finished" } } function Invoke-ADCGetSnmpengineid { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP engine id resource. .PARAMETER Ownernode ID of the cluster node for which you are setting the engineid. .PARAMETER GetAll Retrieve all snmpengineid object(s). .PARAMETER Count If specified, the count of the snmpengineid object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpengineid Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpengineid -GetAll Get all snmpengineid data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpengineid -Count Get the number of snmpengineid objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpengineid -name <string> Get snmpengineid object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpengineid -Filter @{ 'name'='<value>' } Get snmpengineid data with a filter. .NOTES File Name : Invoke-ADCGetSnmpengineid Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpengineid/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateRange(0, 31)] [double]$Ownernode, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpengineid: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpengineid objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpengineid -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpengineid objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpengineid -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpengineid objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpengineid -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpengineid configuration for property 'ownernode'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpengineid -NitroPath nitro/v1/config -Resource $ownernode -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving snmpengineid configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpengineid -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpengineid: Ended" } } function Invoke-ADCAddSnmpgroup { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for SNMP group resource. .PARAMETER Name Name for the SNMPv3 group. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 group. .PARAMETER Securitylevel Security level required for communication between the Citrix ADC and the SNMPv3 users who belong to the group. Specify one of the following options: noAuthNoPriv. Require neither authentication nor encryption. authNoPriv. Require authentication but no encryption. authPriv. Require authentication and encryption. Note: If you specify authentication, you must specify an encryption algorithm when you assign an SNMPv3 user to the group. If you also specify encryption, you must assign both an authentication and an encryption algorithm for each group member. Possible values = noAuthNoPriv, authNoPriv, authPriv .PARAMETER Readviewname Name of the configured SNMPv3 view that you want to bind to this SNMPv3 group. An SNMPv3 user bound to this group can access the subtrees that are bound to this SNMPv3 view as type INCLUDED, but cannot access the ones that are type EXCLUDED. If the Citrix ADC has multiple SNMPv3 view entries with the same name, all such entries are associated with the SNMPv3 group. .EXAMPLE PS C:\>Invoke-ADCAddSnmpgroup -name <string> -securitylevel <string> -readviewname <string> An example how to add snmpgroup configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmpgroup Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpgroup/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(Mandatory)] [ValidateSet('noAuthNoPriv', 'authNoPriv', 'authPriv')] [string]$Securitylevel, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Readviewname ) begin { Write-Verbose "Invoke-ADCAddSnmpgroup: Starting" } process { try { $payload = @{ name = $name securitylevel = $securitylevel readviewname = $readviewname } if ( $PSCmdlet.ShouldProcess("snmpgroup", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpgroup -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmpgroup: Finished" } } function Invoke-ADCDeleteSnmpgroup { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for SNMP group resource. .PARAMETER Name Name for the SNMPv3 group. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 group. .PARAMETER Securitylevel Security level required for communication between the Citrix ADC and the SNMPv3 users who belong to the group. Specify one of the following options: noAuthNoPriv. Require neither authentication nor encryption. authNoPriv. Require authentication but no encryption. authPriv. Require authentication and encryption. Note: If you specify authentication, you must specify an encryption algorithm when you assign an SNMPv3 user to the group. If you also specify encryption, you must assign both an authentication and an encryption algorithm for each group member. Possible values = noAuthNoPriv, authNoPriv, authPriv .EXAMPLE PS C:\>Invoke-ADCDeleteSnmpgroup -Name <string> An example how to delete snmpgroup configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmpgroup Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpgroup/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Name, [string]$Securitylevel ) begin { Write-Verbose "Invoke-ADCDeleteSnmpgroup: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Securitylevel') ) { $arguments.Add('securitylevel', $Securitylevel) } if ( $PSCmdlet.ShouldProcess("$name", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmpgroup -NitroPath nitro/v1/config -Resource $name -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmpgroup: Finished" } } function Invoke-ADCUpdateSnmpgroup { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for SNMP group resource. .PARAMETER Name Name for the SNMPv3 group. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 group. .PARAMETER Securitylevel Security level required for communication between the Citrix ADC and the SNMPv3 users who belong to the group. Specify one of the following options: noAuthNoPriv. Require neither authentication nor encryption. authNoPriv. Require authentication but no encryption. authPriv. Require authentication and encryption. Note: If you specify authentication, you must specify an encryption algorithm when you assign an SNMPv3 user to the group. If you also specify encryption, you must assign both an authentication and an encryption algorithm for each group member. Possible values = noAuthNoPriv, authNoPriv, authPriv .PARAMETER Readviewname Name of the configured SNMPv3 view that you want to bind to this SNMPv3 group. An SNMPv3 user bound to this group can access the subtrees that are bound to this SNMPv3 view as type INCLUDED, but cannot access the ones that are type EXCLUDED. If the Citrix ADC has multiple SNMPv3 view entries with the same name, all such entries are associated with the SNMPv3 group. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpgroup -name <string> -securitylevel <string> -readviewname <string> An example how to update snmpgroup configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpgroup Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpgroup/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(Mandatory)] [ValidateSet('noAuthNoPriv', 'authNoPriv', 'authPriv')] [string]$Securitylevel, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Readviewname ) begin { Write-Verbose "Invoke-ADCUpdateSnmpgroup: Starting" } process { try { $payload = @{ name = $name securitylevel = $securitylevel readviewname = $readviewname } if ( $PSCmdlet.ShouldProcess("snmpgroup", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpgroup -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpgroup: Finished" } } function Invoke-ADCGetSnmpgroup { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP group resource. .PARAMETER GetAll Retrieve all snmpgroup object(s). .PARAMETER Count If specified, the count of the snmpgroup object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpgroup Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpgroup -GetAll Get all snmpgroup data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpgroup -Count Get the number of snmpgroup objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpgroup -name <string> Get snmpgroup object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpgroup -Filter @{ 'name'='<value>' } Get snmpgroup data with a filter. .NOTES File Name : Invoke-ADCGetSnmpgroup Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpgroup/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpgroup: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpgroup objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpgroup -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpgroup objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpgroup -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpgroup objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpgroup -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpgroup configuration for property ''" } else { Write-Verbose "Retrieving snmpgroup configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpgroup -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpgroup: Ended" } } function Invoke-ADCAddSnmpmanager { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for manager resource. .PARAMETER Ipaddress IP address of the SNMP manager. Can be an IPv4 or IPv6 address. You can instead specify an IPv4 network address or IPv6 network prefix if you want the Citrix ADC to respond to SNMP queries from any device on the specified network. Alternatively, instead of an IPv4 address, you can specify a host name that has been assigned to an SNMP manager. If you do so, you must add a DNS name server that resolves the host name of the SNMP manager to its IP address. Note: The Citrix ADC does not support host names for SNMP managers that have IPv6 addresses. .PARAMETER Netmask Subnet mask associated with an IPv4 network address. If the IP address specifies the address or host name of a specific host, accept the default value of 255.255.255.255. .PARAMETER Domainresolveretry Amount of time, in seconds, for which the Citrix ADC waits before sending another DNS query to resolve the host name of the SNMP manager if the last query failed. This parameter is valid for host-name based SNMP managers only. After a query succeeds, the TTL determines the wait time. The minimum and default value is 5. .EXAMPLE PS C:\>Invoke-ADCAddSnmpmanager -ipaddress <string> An example how to add snmpmanager configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmpmanager Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmanager/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateLength(1, 255)] [string]$Ipaddress, [string]$Netmask, [ValidateRange(5, 20939)] [int]$Domainresolveretry ) begin { Write-Verbose "Invoke-ADCAddSnmpmanager: Starting" } process { try { $payload = @{ ipaddress = $ipaddress } if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) } if ( $PSBoundParameters.ContainsKey('domainresolveretry') ) { $payload.Add('domainresolveretry', $domainresolveretry) } if ( $PSCmdlet.ShouldProcess("snmpmanager", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpmanager -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmpmanager: Finished" } } function Invoke-ADCDeleteSnmpmanager { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for manager resource. .PARAMETER Ipaddress IP address of the SNMP manager. Can be an IPv4 or IPv6 address. You can instead specify an IPv4 network address or IPv6 network prefix if you want the Citrix ADC to respond to SNMP queries from any device on the specified network. Alternatively, instead of an IPv4 address, you can specify a host name that has been assigned to an SNMP manager. If you do so, you must add a DNS name server that resolves the host name of the SNMP manager to its IP address. Note: The Citrix ADC does not support host names for SNMP managers that have IPv6 addresses. .PARAMETER Netmask Subnet mask associated with an IPv4 network address. If the IP address specifies the address or host name of a specific host, accept the default value of 255.255.255.255. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmpmanager -Ipaddress <string> An example how to delete snmpmanager configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmpmanager Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmanager/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Ipaddress, [string]$Netmask ) begin { Write-Verbose "Invoke-ADCDeleteSnmpmanager: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Netmask') ) { $arguments.Add('netmask', $Netmask) } if ( $PSCmdlet.ShouldProcess("$ipaddress", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmpmanager -NitroPath nitro/v1/config -Resource $ipaddress -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmpmanager: Finished" } } function Invoke-ADCUpdateSnmpmanager { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for manager resource. .PARAMETER Ipaddress IP address of the SNMP manager. Can be an IPv4 or IPv6 address. You can instead specify an IPv4 network address or IPv6 network prefix if you want the Citrix ADC to respond to SNMP queries from any device on the specified network. Alternatively, instead of an IPv4 address, you can specify a host name that has been assigned to an SNMP manager. If you do so, you must add a DNS name server that resolves the host name of the SNMP manager to its IP address. Note: The Citrix ADC does not support host names for SNMP managers that have IPv6 addresses. .PARAMETER Netmask Subnet mask associated with an IPv4 network address. If the IP address specifies the address or host name of a specific host, accept the default value of 255.255.255.255. .PARAMETER Domainresolveretry Amount of time, in seconds, for which the Citrix ADC waits before sending another DNS query to resolve the host name of the SNMP manager if the last query failed. This parameter is valid for host-name based SNMP managers only. After a query succeeds, the TTL determines the wait time. The minimum and default value is 5. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpmanager -ipaddress <string> An example how to update snmpmanager configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpmanager Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmanager/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateLength(1, 255)] [string]$Ipaddress, [string]$Netmask, [ValidateRange(5, 20939)] [int]$Domainresolveretry ) begin { Write-Verbose "Invoke-ADCUpdateSnmpmanager: Starting" } process { try { $payload = @{ ipaddress = $ipaddress } if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) } if ( $PSBoundParameters.ContainsKey('domainresolveretry') ) { $payload.Add('domainresolveretry', $domainresolveretry) } if ( $PSCmdlet.ShouldProcess("snmpmanager", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpmanager -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpmanager: Finished" } } function Invoke-ADCUnsetSnmpmanager { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for manager resource. .PARAMETER Ipaddress IP address of the SNMP manager. Can be an IPv4 or IPv6 address. You can instead specify an IPv4 network address or IPv6 network prefix if you want the Citrix ADC to respond to SNMP queries from any device on the specified network. Alternatively, instead of an IPv4 address, you can specify a host name that has been assigned to an SNMP manager. If you do so, you must add a DNS name server that resolves the host name of the SNMP manager to its IP address. Note: The Citrix ADC does not support host names for SNMP managers that have IPv6 addresses. .PARAMETER Netmask Subnet mask associated with an IPv4 network address. If the IP address specifies the address or host name of a specific host, accept the default value of 255.255.255.255. .PARAMETER Domainresolveretry Amount of time, in seconds, for which the Citrix ADC waits before sending another DNS query to resolve the host name of the SNMP manager if the last query failed. This parameter is valid for host-name based SNMP managers only. After a query succeeds, the TTL determines the wait time. The minimum and default value is 5. .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpmanager -ipaddress <string> An example how to unset snmpmanager configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpmanager Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmanager Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateLength(1, 255)] [string]$Ipaddress, [Boolean]$netmask, [Boolean]$domainresolveretry ) begin { Write-Verbose "Invoke-ADCUnsetSnmpmanager: Starting" } process { try { $payload = @{ ipaddress = $ipaddress } if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) } if ( $PSBoundParameters.ContainsKey('domainresolveretry') ) { $payload.Add('domainresolveretry', $domainresolveretry) } if ( $PSCmdlet.ShouldProcess("$ipaddress", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpmanager -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpmanager: Finished" } } function Invoke-ADCGetSnmpmanager { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for manager resource. .PARAMETER GetAll Retrieve all snmpmanager object(s). .PARAMETER Count If specified, the count of the snmpmanager object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmanager Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmanager -GetAll Get all snmpmanager data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmanager -Count Get the number of snmpmanager objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmanager -name <string> Get snmpmanager object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmanager -Filter @{ 'name'='<value>' } Get snmpmanager data with a filter. .NOTES File Name : Invoke-ADCGetSnmpmanager Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmanager/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpmanager: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpmanager objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmanager -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpmanager objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmanager -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpmanager objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmanager -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpmanager configuration for property ''" } else { Write-Verbose "Retrieving snmpmanager configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmanager -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpmanager: Ended" } } function Invoke-ADCUpdateSnmpmib { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for SNMP mib resource. .PARAMETER Contact Name of the administrator for this Citrix ADC. Along with the name, you can include information on how to contact this person, such as a phone number or an email address. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Name Name for this Citrix ADC. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the Citrix ADC appliance. .PARAMETER Location Physical location of the Citrix ADC. For example, you can specify building name, lab number, and rack number. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Customid Custom identification number for the Citrix ADC. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a custom identification that helps identify the Citrix ADC appliance. .PARAMETER Ownernode ID of the cluster node for which we are setting the mib. This is a mandatory argument to set snmp mib on CLIP. .PARAMETER PassThru Return details about the created snmpmib item. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpmib An example how to update snmpmib configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpmib Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmib/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateScript({ $_.Length -gt 1 })] [string]$Contact, [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [ValidateScript({ $_.Length -gt 1 })] [string]$Location, [ValidateScript({ $_.Length -gt 1 })] [string]$Customid, [ValidateRange(0, 31)] [double]$Ownernode, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCUpdateSnmpmib: Starting" } process { try { $payload = @{ } if ( $PSBoundParameters.ContainsKey('contact') ) { $payload.Add('contact', $contact) } if ( $PSBoundParameters.ContainsKey('name') ) { $payload.Add('name', $name) } if ( $PSBoundParameters.ContainsKey('location') ) { $payload.Add('location', $location) } if ( $PSBoundParameters.ContainsKey('customid') ) { $payload.Add('customid', $customid) } if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) } if ( $PSCmdlet.ShouldProcess("snmpmib", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpmib -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpmib -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpmib: Finished" } } function Invoke-ADCUnsetSnmpmib { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for SNMP mib resource. .PARAMETER Contact Name of the administrator for this Citrix ADC. Along with the name, you can include information on how to contact this person, such as a phone number or an email address. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Name Name for this Citrix ADC. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the Citrix ADC appliance. .PARAMETER Location Physical location of the Citrix ADC. For example, you can specify building name, lab number, and rack number. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Customid Custom identification number for the Citrix ADC. Can consist of 1 to 127 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a custom identification that helps identify the Citrix ADC appliance. .PARAMETER Ownernode ID of the cluster node for which we are setting the mib. This is a mandatory argument to set snmp mib on CLIP. .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpmib An example how to unset snmpmib configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpmib Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmib Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Boolean]$contact, [Boolean]$name, [Boolean]$location, [Boolean]$customid, [Boolean]$ownernode ) begin { Write-Verbose "Invoke-ADCUnsetSnmpmib: Starting" } process { try { $payload = @{ } if ( $PSBoundParameters.ContainsKey('contact') ) { $payload.Add('contact', $contact) } if ( $PSBoundParameters.ContainsKey('name') ) { $payload.Add('name', $name) } if ( $PSBoundParameters.ContainsKey('location') ) { $payload.Add('location', $location) } if ( $PSBoundParameters.ContainsKey('customid') ) { $payload.Add('customid', $customid) } if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) } if ( $PSCmdlet.ShouldProcess("snmpmib", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpmib -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpmib: Finished" } } function Invoke-ADCGetSnmpmib { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP mib resource. .PARAMETER Ownernode ID of the cluster node for which we are setting the mib. This is a mandatory argument to set snmp mib on CLIP. .PARAMETER GetAll Retrieve all snmpmib object(s). .PARAMETER Count If specified, the count of the snmpmib object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmib Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmib -GetAll Get all snmpmib data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmib -Count Get the number of snmpmib objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmib -name <string> Get snmpmib object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpmib -Filter @{ 'name'='<value>' } Get snmpmib data with a filter. .NOTES File Name : Invoke-ADCGetSnmpmib Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpmib/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateRange(0, 31)] [double]$Ownernode, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpmib: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpmib objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmib -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpmib objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmib -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpmib objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmib -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpmib configuration for property 'ownernode'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmib -NitroPath nitro/v1/config -Resource $ownernode -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving snmpmib configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpmib -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpmib: Ended" } } function Invoke-ADCGetSnmpoid { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP Object Identifier resource. .PARAMETER Entitytype The type of entity whose SNMP OIDs you want to displayType of entity whose SNMP OIDs you want the Citrix ADC to display. Possible values = VSERVER, SERVICE, SERVICEGROUP .PARAMETER Name Name of the entity whose SNMP OID you want the Citrix ADC to display. .PARAMETER GetAll Retrieve all snmpoid object(s). .PARAMETER Count If specified, the count of the snmpoid object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoid Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoid -GetAll Get all snmpoid data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoid -Count Get the number of snmpoid objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoid -name <string> Get snmpoid object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoid -Filter @{ 'name'='<value>' } Get snmpoid data with a filter. .NOTES File Name : Invoke-ADCGetSnmpoid Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpoid/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByArgument')] [ValidateSet('VSERVER', 'SERVICE', 'SERVICEGROUP')] [string]$Entitytype, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpoid: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpoid objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoid -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpoid objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoid -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpoid objects by arguments" $arguments = @{ } if ( $PSBoundParameters.ContainsKey('entitytype') ) { $arguments.Add('entitytype', $entitytype) } if ( $PSBoundParameters.ContainsKey('name') ) { $arguments.Add('name', $name) } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoid -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpoid configuration for property ''" } else { Write-Verbose "Retrieving snmpoid configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoid -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpoid: Ended" } } function Invoke-ADCUpdateSnmpoption { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for SNMP option resource. .PARAMETER Snmpset Accept SNMP SET requests sent to the Citrix ADC, and allow SNMP managers to write values to MIB objects that are configured for write access. Possible values = ENABLED, DISABLED .PARAMETER Snmptraplogging Log any SNMP trap events (for SNMP alarms in which logging is enabled) even if no trap listeners are configured. With the default setting, SNMP trap events are logged if at least one trap listener is configured on the appliance. Possible values = ENABLED, DISABLED .PARAMETER Partitionnameintrap Send partition name as a varbind in traps. By default the partition names are not sent as a varbind. Possible values = ENABLED, DISABLED .PARAMETER Snmptraplogginglevel Audit log level of SNMP trap logs. The default value is INFORMATIONAL. Possible values = EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, DEBUG .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpoption An example how to update snmpoption configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpoption Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpoption/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateSet('ENABLED', 'DISABLED')] [string]$Snmpset, [ValidateSet('ENABLED', 'DISABLED')] [string]$Snmptraplogging, [ValidateSet('ENABLED', 'DISABLED')] [string]$Partitionnameintrap, [ValidateSet('EMERGENCY', 'ALERT', 'CRITICAL', 'ERROR', 'WARNING', 'NOTICE', 'INFORMATIONAL', 'DEBUG')] [string]$Snmptraplogginglevel ) begin { Write-Verbose "Invoke-ADCUpdateSnmpoption: Starting" } process { try { $payload = @{ } if ( $PSBoundParameters.ContainsKey('snmpset') ) { $payload.Add('snmpset', $snmpset) } if ( $PSBoundParameters.ContainsKey('snmptraplogging') ) { $payload.Add('snmptraplogging', $snmptraplogging) } if ( $PSBoundParameters.ContainsKey('partitionnameintrap') ) { $payload.Add('partitionnameintrap', $partitionnameintrap) } if ( $PSBoundParameters.ContainsKey('snmptraplogginglevel') ) { $payload.Add('snmptraplogginglevel', $snmptraplogginglevel) } if ( $PSCmdlet.ShouldProcess("snmpoption", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpoption -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpoption: Finished" } } function Invoke-ADCUnsetSnmpoption { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for SNMP option resource. .PARAMETER Snmpset Accept SNMP SET requests sent to the Citrix ADC, and allow SNMP managers to write values to MIB objects that are configured for write access. Possible values = ENABLED, DISABLED .PARAMETER Snmptraplogging Log any SNMP trap events (for SNMP alarms in which logging is enabled) even if no trap listeners are configured. With the default setting, SNMP trap events are logged if at least one trap listener is configured on the appliance. Possible values = ENABLED, DISABLED .PARAMETER Partitionnameintrap Send partition name as a varbind in traps. By default the partition names are not sent as a varbind. Possible values = ENABLED, DISABLED .PARAMETER Snmptraplogginglevel Audit log level of SNMP trap logs. The default value is INFORMATIONAL. Possible values = EMERGENCY, ALERT, CRITICAL, ERROR, WARNING, NOTICE, INFORMATIONAL, DEBUG .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpoption An example how to unset snmpoption configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpoption Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpoption Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Boolean]$snmpset, [Boolean]$snmptraplogging, [Boolean]$partitionnameintrap, [Boolean]$snmptraplogginglevel ) begin { Write-Verbose "Invoke-ADCUnsetSnmpoption: Starting" } process { try { $payload = @{ } if ( $PSBoundParameters.ContainsKey('snmpset') ) { $payload.Add('snmpset', $snmpset) } if ( $PSBoundParameters.ContainsKey('snmptraplogging') ) { $payload.Add('snmptraplogging', $snmptraplogging) } if ( $PSBoundParameters.ContainsKey('partitionnameintrap') ) { $payload.Add('partitionnameintrap', $partitionnameintrap) } if ( $PSBoundParameters.ContainsKey('snmptraplogginglevel') ) { $payload.Add('snmptraplogginglevel', $snmptraplogginglevel) } if ( $PSCmdlet.ShouldProcess("snmpoption", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpoption -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpoption: Finished" } } function Invoke-ADCGetSnmpoption { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP option resource. .PARAMETER GetAll Retrieve all snmpoption object(s). .PARAMETER Count If specified, the count of the snmpoption object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoption Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoption -GetAll Get all snmpoption data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoption -name <string> Get snmpoption object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpoption -Filter @{ 'name'='<value>' } Get snmpoption data with a filter. .NOTES File Name : Invoke-ADCGetSnmpoption Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpoption/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll ) begin { Write-Verbose "Invoke-ADCGetSnmpoption: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpoption objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoption -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpoption objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoption -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpoption objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoption -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpoption configuration for property ''" } else { Write-Verbose "Retrieving snmpoption configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpoption -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpoption: Ended" } } function Invoke-ADCAddSnmptrap { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for snmp trap resource. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Destport UDP port at which the trap listener listens for trap messages. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. .PARAMETER Communityname Password (string) sent with the trap messages, so that the trap listener can authenticate them. Can include 1 to 31 uppercase or lowercase letters, numbers, and hyphen (-), period (.) pound (#), space ( ), at (@), equals (=), colon (:), and underscore (_) characters. You must specify the same community string on the trap listener device. Otherwise, the trap listener drops the trap messages. .PARAMETER Srcip IPv4 or IPv6 address that the Citrix ADC inserts as the source IP address in all SNMP trap messages that it sends to this trap listener. By default this is the appliance's NSIP or NSIP6 address, but you can specify an IPv4 MIP or SNIP/SNIP6 address. In cluster setup, the default value is the individual node's NSIP, but it can be set to CLIP or Striped SNIP address. In non default partition, this parameter must be set to the SNIP/SNIP6 address. .PARAMETER Severity Severity level at or above which the Citrix ADC sends trap messages to this trap listener. The severity levels, in increasing order of severity, are Informational, Warning, Minor, Major, Critical. This parameter can be set for trap listeners of type SPECIFIC only. The default is to send all levels of trap messages. Important: Trap messages are not assigned severity levels unless you specify severity levels when configuring SNMP alarms. Possible values = Critical, Major, Minor, Warning, Informational .PARAMETER Allpartitions Send traps of all partitions to this destination. Possible values = ENABLED, DISABLED .EXAMPLE PS C:\>Invoke-ADCAddSnmptrap -trapclass <string> -trapdestination <string> An example how to add snmptrap configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmptrap Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('generic', 'specific')] [string]$Trapclass, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [ValidateSet('V1', 'V2', 'V3')] [string]$Version = 'V2', [ValidateRange(0, 4094)] [double]$Td, [ValidateRange(1, 65534)] [int]$Destport = '162', [string]$Communityname, [ValidateScript({ $_.Length -gt 1 })] [string]$Srcip, [ValidateSet('Critical', 'Major', 'Minor', 'Warning', 'Informational')] [string]$Severity = 'Unknown', [ValidateSet('ENABLED', 'DISABLED')] [string]$Allpartitions = 'DISABLED' ) begin { Write-Verbose "Invoke-ADCAddSnmptrap: Starting" } process { try { $payload = @{ trapclass = $trapclass trapdestination = $trapdestination } if ( $PSBoundParameters.ContainsKey('version') ) { $payload.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) } if ( $PSBoundParameters.ContainsKey('communityname') ) { $payload.Add('communityname', $communityname) } if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) } if ( $PSBoundParameters.ContainsKey('severity') ) { $payload.Add('severity', $severity) } if ( $PSBoundParameters.ContainsKey('allpartitions') ) { $payload.Add('allpartitions', $allpartitions) } if ( $PSCmdlet.ShouldProcess("snmptrap", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmptrap -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmptrap: Finished" } } function Invoke-ADCDeleteSnmptrap { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for snmp trap resource. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmptrap -Trapclass <string> An example how to delete snmptrap configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmptrap Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Trapclass, [string]$Trapdestination, [string]$Version, [double]$Td ) begin { Write-Verbose "Invoke-ADCDeleteSnmptrap: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Trapdestination') ) { $arguments.Add('trapdestination', $Trapdestination) } if ( $PSBoundParameters.ContainsKey('Version') ) { $arguments.Add('version', $Version) } if ( $PSBoundParameters.ContainsKey('Td') ) { $arguments.Add('td', $Td) } if ( $PSCmdlet.ShouldProcess("$trapclass", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmptrap -NitroPath nitro/v1/config -Resource $trapclass -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmptrap: Finished" } } function Invoke-ADCUpdateSnmptrap { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for snmp trap resource. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Destport UDP port at which the trap listener listens for trap messages. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. .PARAMETER Communityname Password (string) sent with the trap messages, so that the trap listener can authenticate them. Can include 1 to 31 uppercase or lowercase letters, numbers, and hyphen (-), period (.) pound (#), space ( ), at (@), equals (=), colon (:), and underscore (_) characters. You must specify the same community string on the trap listener device. Otherwise, the trap listener drops the trap messages. .PARAMETER Srcip IPv4 or IPv6 address that the Citrix ADC inserts as the source IP address in all SNMP trap messages that it sends to this trap listener. By default this is the appliance's NSIP or NSIP6 address, but you can specify an IPv4 MIP or SNIP/SNIP6 address. In cluster setup, the default value is the individual node's NSIP, but it can be set to CLIP or Striped SNIP address. In non default partition, this parameter must be set to the SNIP/SNIP6 address. .PARAMETER Severity Severity level at or above which the Citrix ADC sends trap messages to this trap listener. The severity levels, in increasing order of severity, are Informational, Warning, Minor, Major, Critical. This parameter can be set for trap listeners of type SPECIFIC only. The default is to send all levels of trap messages. Important: Trap messages are not assigned severity levels unless you specify severity levels when configuring SNMP alarms. Possible values = Critical, Major, Minor, Warning, Informational .PARAMETER Allpartitions Send traps of all partitions to this destination. Possible values = ENABLED, DISABLED .EXAMPLE PS C:\>Invoke-ADCUpdateSnmptrap -trapclass <string> -trapdestination <string> An example how to update snmptrap configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmptrap Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('generic', 'specific')] [string]$Trapclass, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [ValidateSet('V1', 'V2', 'V3')] [string]$Version, [ValidateRange(0, 4094)] [double]$Td, [ValidateRange(1, 65534)] [int]$Destport, [string]$Communityname, [ValidateScript({ $_.Length -gt 1 })] [string]$Srcip, [ValidateSet('Critical', 'Major', 'Minor', 'Warning', 'Informational')] [string]$Severity, [ValidateSet('ENABLED', 'DISABLED')] [string]$Allpartitions ) begin { Write-Verbose "Invoke-ADCUpdateSnmptrap: Starting" } process { try { $payload = @{ trapclass = $trapclass trapdestination = $trapdestination } if ( $PSBoundParameters.ContainsKey('version') ) { $payload.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) } if ( $PSBoundParameters.ContainsKey('communityname') ) { $payload.Add('communityname', $communityname) } if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) } if ( $PSBoundParameters.ContainsKey('severity') ) { $payload.Add('severity', $severity) } if ( $PSBoundParameters.ContainsKey('allpartitions') ) { $payload.Add('allpartitions', $allpartitions) } if ( $PSCmdlet.ShouldProcess("snmptrap", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmptrap -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmptrap: Finished" } } function Invoke-ADCUnsetSnmptrap { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for snmp trap resource. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Destport UDP port at which the trap listener listens for trap messages. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. .PARAMETER Communityname Password (string) sent with the trap messages, so that the trap listener can authenticate them. Can include 1 to 31 uppercase or lowercase letters, numbers, and hyphen (-), period (.) pound (#), space ( ), at (@), equals (=), colon (:), and underscore (_) characters. You must specify the same community string on the trap listener device. Otherwise, the trap listener drops the trap messages. .PARAMETER Srcip IPv4 or IPv6 address that the Citrix ADC inserts as the source IP address in all SNMP trap messages that it sends to this trap listener. By default this is the appliance's NSIP or NSIP6 address, but you can specify an IPv4 MIP or SNIP/SNIP6 address. In cluster setup, the default value is the individual node's NSIP, but it can be set to CLIP or Striped SNIP address. In non default partition, this parameter must be set to the SNIP/SNIP6 address. .PARAMETER Severity Severity level at or above which the Citrix ADC sends trap messages to this trap listener. The severity levels, in increasing order of severity, are Informational, Warning, Minor, Major, Critical. This parameter can be set for trap listeners of type SPECIFIC only. The default is to send all levels of trap messages. Important: Trap messages are not assigned severity levels unless you specify severity levels when configuring SNMP alarms. Possible values = Critical, Major, Minor, Warning, Informational .PARAMETER Allpartitions Send traps of all partitions to this destination. Possible values = ENABLED, DISABLED .EXAMPLE PS C:\>Invoke-ADCUnsetSnmptrap -trapclass <string> -trapdestination <string> An example how to unset snmptrap configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmptrap Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateSet('generic', 'specific')] [string]$Trapclass, [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [Boolean]$version, [Boolean]$td, [Boolean]$destport, [Boolean]$communityname, [Boolean]$srcip, [Boolean]$severity, [Boolean]$allpartitions ) begin { Write-Verbose "Invoke-ADCUnsetSnmptrap: Starting" } process { try { $payload = @{ trapclass = $trapclass trapdestination = $trapdestination } if ( $PSBoundParameters.ContainsKey('version') ) { $payload.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) } if ( $PSBoundParameters.ContainsKey('communityname') ) { $payload.Add('communityname', $communityname) } if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) } if ( $PSBoundParameters.ContainsKey('severity') ) { $payload.Add('severity', $severity) } if ( $PSBoundParameters.ContainsKey('allpartitions') ) { $payload.Add('allpartitions', $allpartitions) } if ( $PSCmdlet.ShouldProcess("$trapclass trapdestination", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmptrap -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmptrap: Finished" } } function Invoke-ADCGetSnmptrap { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for snmp trap resource. .PARAMETER GetAll Retrieve all snmptrap object(s). .PARAMETER Count If specified, the count of the snmptrap object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrap Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrap -GetAll Get all snmptrap data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrap -Count Get the number of snmptrap objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrap -name <string> Get snmptrap object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrap -Filter @{ 'name'='<value>' } Get snmptrap data with a filter. .NOTES File Name : Invoke-ADCGetSnmptrap Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmptrap: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmptrap objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmptrap objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmptrap objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmptrap configuration for property ''" } else { Write-Verbose "Retrieving snmptrap configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmptrap: Ended" } } function Invoke-ADCGetSnmptrapbinding { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Binding object which returns the resources bound to snmptrap. .PARAMETER Trapdestination IP address specified in the trap listener entry. .PARAMETER Version The SNMP version of the trap specified in the trap listener entry. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Trapclass Trap type specified in the trap listener entry. Possible values = generic, specific .PARAMETER GetAll Retrieve all snmptrap_binding object(s). .PARAMETER Count If specified, the count of the snmptrap_binding object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapbinding Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapbinding -GetAll Get all snmptrap_binding data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapbinding -name <string> Get snmptrap_binding object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapbinding -Filter @{ 'name'='<value>' } Get snmptrap_binding data with a filter. .NOTES File Name : Invoke-ADCGetSnmptrapbinding Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByArgument')] [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateSet('V1', 'V2', 'V3')] [string]$Version, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateRange(0, 4094)] [double]$Td, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateSet('generic', 'specific')] [string]$Trapclass, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll ) begin { Write-Verbose "Invoke-ADCGetSnmptrapbinding: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ bulkbindings = 'yes' } Write-Verbose "Retrieving all snmptrap_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmptrap_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmptrap_binding objects by arguments" $arguments = @{ } if ( $PSBoundParameters.ContainsKey('trapdestination') ) { $arguments.Add('trapdestination', $trapdestination) } if ( $PSBoundParameters.ContainsKey('version') ) { $arguments.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('td') ) { $arguments.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('trapclass') ) { $arguments.Add('trapclass', $trapclass) } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmptrap_binding configuration for property ''" } else { Write-Verbose "Retrieving snmptrap_binding configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmptrapbinding: Ended" } } function Invoke-ADCAddSnmptrapsnmpuserbinding { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Binding object showing the snmpuser that can be bound to snmptrap. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Username Name of the SNMP user that will send the SNMPv3 traps. .PARAMETER Securitylevel Security level of the SNMPv3 trap. Possible values = noAuthNoPriv, authNoPriv, authPriv .PARAMETER PassThru Return details about the created snmptrap_snmpuser_binding item. .EXAMPLE PS C:\>Invoke-ADCAddSnmptrapsnmpuserbinding -trapclass <string> -trapdestination <string> -username <string> An example how to add snmptrap_snmpuser_binding configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmptrapsnmpuserbinding Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap_snmpuser_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateSet('generic', 'specific')] [string]$Trapclass, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [ValidateRange(0, 4094)] [double]$Td, [ValidateSet('V1', 'V2', 'V3')] [string]$Version = 'V3', [Parameter(Mandatory)] [string]$Username, [ValidateSet('noAuthNoPriv', 'authNoPriv', 'authPriv')] [string]$Securitylevel = 'authNoPriv', [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCAddSnmptrapsnmpuserbinding: Starting" } process { try { $payload = @{ trapclass = $trapclass trapdestination = $trapdestination username = $username } if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('version') ) { $payload.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('securitylevel') ) { $payload.Add('securitylevel', $securitylevel) } if ( $PSCmdlet.ShouldProcess("snmptrap_snmpuser_binding", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmptrap_snmpuser_binding -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmptrapsnmpuserbinding -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmptrapsnmpuserbinding: Finished" } } function Invoke-ADCDeleteSnmptrapsnmpuserbinding { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Binding object showing the snmpuser that can be bound to snmptrap. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Username Name of the SNMP user that will send the SNMPv3 traps. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmptrapsnmpuserbinding -Trapclass <string> An example how to delete snmptrap_snmpuser_binding configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmptrapsnmpuserbinding Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap_snmpuser_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Trapclass, [string]$Trapdestination, [double]$Td, [string]$Version, [string]$Username ) begin { Write-Verbose "Invoke-ADCDeleteSnmptrapsnmpuserbinding: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Trapdestination') ) { $arguments.Add('trapdestination', $Trapdestination) } if ( $PSBoundParameters.ContainsKey('Td') ) { $arguments.Add('td', $Td) } if ( $PSBoundParameters.ContainsKey('Version') ) { $arguments.Add('version', $Version) } if ( $PSBoundParameters.ContainsKey('Username') ) { $arguments.Add('username', $Username) } if ( $PSCmdlet.ShouldProcess("$trapclass", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmptrap_snmpuser_binding -NitroPath nitro/v1/config -Resource $trapclass -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmptrapsnmpuserbinding: Finished" } } function Invoke-ADCGetSnmptrapsnmpuserbinding { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Binding object showing the snmpuser that can be bound to snmptrap. .PARAMETER Trapdestination IPv4 or the IPv6 address of the trap listener to which the Citrix ADC is to send SNMP trap messages. .PARAMETER Version SNMP version, which determines the format of trap messages sent to the trap listener. This setting must match the setting on the trap listener. Otherwise, the listener drops the trap messages. Possible values = V1, V2, V3 .PARAMETER Td Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. .PARAMETER Trapclass Type of trap messages that the Citrix ADC sends to the trap listener: Generic or the enterprise-specific messages defined in the MIB file. Possible values = generic, specific .PARAMETER GetAll Retrieve all snmptrap_snmpuser_binding object(s). .PARAMETER Count If specified, the count of the snmptrap_snmpuser_binding object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapsnmpuserbinding Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapsnmpuserbinding -GetAll Get all snmptrap_snmpuser_binding data. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapsnmpuserbinding -Count Get the number of snmptrap_snmpuser_binding objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapsnmpuserbinding -name <string> Get snmptrap_snmpuser_binding object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmptrapsnmpuserbinding -Filter @{ 'name'='<value>' } Get snmptrap_snmpuser_binding data with a filter. .NOTES File Name : Invoke-ADCGetSnmptrapsnmpuserbinding Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmptrap_snmpuser_binding/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByArgument')] [ValidateScript({ $_.Length -gt 1 })] [string]$Trapdestination, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateSet('V1', 'V2', 'V3')] [string]$Version, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateRange(0, 4094)] [double]$Td, [Parameter(ParameterSetName = 'GetByArgument')] [ValidateSet('generic', 'specific')] [string]$Trapclass, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll ) begin { Write-Verbose "Invoke-ADCGetSnmptrapsnmpuserbinding: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ bulkbindings = 'yes' } Write-Verbose "Retrieving all snmptrap_snmpuser_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_snmpuser_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmptrap_snmpuser_binding objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_snmpuser_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmptrap_snmpuser_binding objects by arguments" $arguments = @{ } if ( $PSBoundParameters.ContainsKey('trapdestination') ) { $arguments.Add('trapdestination', $trapdestination) } if ( $PSBoundParameters.ContainsKey('version') ) { $arguments.Add('version', $version) } if ( $PSBoundParameters.ContainsKey('td') ) { $arguments.Add('td', $td) } if ( $PSBoundParameters.ContainsKey('trapclass') ) { $arguments.Add('trapclass', $trapclass) } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_snmpuser_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmptrap_snmpuser_binding configuration for property ''" } else { Write-Verbose "Retrieving snmptrap_snmpuser_binding configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmptrap_snmpuser_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmptrapsnmpuserbinding: Ended" } } function Invoke-ADCAddSnmpuser { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for SNMP user resource. .PARAMETER Name Name for the SNMPv3 user. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Group Name of the configured SNMPv3 group to which to bind this SNMPv3 user. The access rights (bound SNMPv3 views) and security level set for this group are assigned to this user. .PARAMETER Authtype Authentication algorithm used by the Citrix ADC and the SNMPv3 user for authenticating the communication between them. You must specify the same authentication algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = MD5, SHA .PARAMETER Authpasswd Plain-text pass phrase to be used by the authentication algorithm specified by the authType (Authentication Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Privtype Encryption algorithm used by the Citrix ADC and the SNMPv3 user for encrypting the communication between them. You must specify the same encryption algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = DES, AES .PARAMETER Privpasswd Encryption key to be used by the encryption algorithm specified by the privType (Encryption Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER PassThru Return details about the created snmpuser item. .EXAMPLE PS C:\>Invoke-ADCAddSnmpuser -name <string> -group <string> An example how to add snmpuser configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmpuser Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpuser/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Group, [ValidateSet('MD5', 'SHA')] [string]$Authtype, [ValidateScript({ $_.Length -gt 1 })] [string]$Authpasswd, [ValidateSet('DES', 'AES')] [string]$Privtype, [ValidateScript({ $_.Length -gt 1 })] [string]$Privpasswd, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCAddSnmpuser: Starting" } process { try { $payload = @{ name = $name group = $group } if ( $PSBoundParameters.ContainsKey('authtype') ) { $payload.Add('authtype', $authtype) } if ( $PSBoundParameters.ContainsKey('authpasswd') ) { $payload.Add('authpasswd', $authpasswd) } if ( $PSBoundParameters.ContainsKey('privtype') ) { $payload.Add('privtype', $privtype) } if ( $PSBoundParameters.ContainsKey('privpasswd') ) { $payload.Add('privpasswd', $privpasswd) } if ( $PSCmdlet.ShouldProcess("snmpuser", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpuser -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpuser -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmpuser: Finished" } } function Invoke-ADCDeleteSnmpuser { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for SNMP user resource. .PARAMETER Name Name for the SNMPv3 user. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmpuser -Name <string> An example how to delete snmpuser configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmpuser Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpuser/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Name ) begin { Write-Verbose "Invoke-ADCDeleteSnmpuser: Starting" } process { try { $arguments = @{ } if ( $PSCmdlet.ShouldProcess("$name", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmpuser -NitroPath nitro/v1/config -Resource $name -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmpuser: Finished" } } function Invoke-ADCUpdateSnmpuser { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for SNMP user resource. .PARAMETER Name Name for the SNMPv3 user. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Group Name of the configured SNMPv3 group to which to bind this SNMPv3 user. The access rights (bound SNMPv3 views) and security level set for this group are assigned to this user. .PARAMETER Authtype Authentication algorithm used by the Citrix ADC and the SNMPv3 user for authenticating the communication between them. You must specify the same authentication algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = MD5, SHA .PARAMETER Authpasswd Plain-text pass phrase to be used by the authentication algorithm specified by the authType (Authentication Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Privtype Encryption algorithm used by the Citrix ADC and the SNMPv3 user for encrypting the communication between them. You must specify the same encryption algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = DES, AES .PARAMETER Privpasswd Encryption key to be used by the encryption algorithm specified by the privType (Encryption Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER PassThru Return details about the created snmpuser item. .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpuser -name <string> An example how to update snmpuser configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpuser Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpuser/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [ValidateScript({ $_.Length -gt 1 })] [string]$Group, [ValidateSet('MD5', 'SHA')] [string]$Authtype, [ValidateScript({ $_.Length -gt 1 })] [string]$Authpasswd, [ValidateSet('DES', 'AES')] [string]$Privtype, [ValidateScript({ $_.Length -gt 1 })] [string]$Privpasswd, [Switch]$PassThru ) begin { Write-Verbose "Invoke-ADCUpdateSnmpuser: Starting" } process { try { $payload = @{ name = $name } if ( $PSBoundParameters.ContainsKey('group') ) { $payload.Add('group', $group) } if ( $PSBoundParameters.ContainsKey('authtype') ) { $payload.Add('authtype', $authtype) } if ( $PSBoundParameters.ContainsKey('authpasswd') ) { $payload.Add('authpasswd', $authpasswd) } if ( $PSBoundParameters.ContainsKey('privtype') ) { $payload.Add('privtype', $privtype) } if ( $PSBoundParameters.ContainsKey('privpasswd') ) { $payload.Add('privpasswd', $privpasswd) } if ( $PSCmdlet.ShouldProcess("snmpuser", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpuser -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error if ( $PSBoundParameters.ContainsKey('PassThru') ) { Write-Output (Invoke-ADCGetSnmpuser -Filter $payload) } else { Write-Output $result } } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpuser: Finished" } } function Invoke-ADCUnsetSnmpuser { <# .SYNOPSIS Unset SNMP configuration Object. .DESCRIPTION Configuration for SNMP user resource. .PARAMETER Name Name for the SNMPv3 user. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Authtype Authentication algorithm used by the Citrix ADC and the SNMPv3 user for authenticating the communication between them. You must specify the same authentication algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = MD5, SHA .PARAMETER Privtype Encryption algorithm used by the Citrix ADC and the SNMPv3 user for encrypting the communication between them. You must specify the same encryption algorithm when you configure the SNMPv3 user in the SNMP manager. Possible values = DES, AES .PARAMETER Authpasswd Plain-text pass phrase to be used by the authentication algorithm specified by the authType (Authentication Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER Privpasswd Encryption key to be used by the encryption algorithm specified by the privType (Encryption Type) parameter. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .EXAMPLE PS C:\>Invoke-ADCUnsetSnmpuser -name <string> An example how to unset snmpuser configuration Object(s). .NOTES File Name : Invoke-ADCUnsetSnmpuser Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpuser Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Boolean]$authtype, [Boolean]$privtype, [Boolean]$authpasswd, [Boolean]$privpasswd ) begin { Write-Verbose "Invoke-ADCUnsetSnmpuser: Starting" } process { try { $payload = @{ name = $name } if ( $PSBoundParameters.ContainsKey('authtype') ) { $payload.Add('authtype', $authtype) } if ( $PSBoundParameters.ContainsKey('privtype') ) { $payload.Add('privtype', $privtype) } if ( $PSBoundParameters.ContainsKey('authpasswd') ) { $payload.Add('authpasswd', $authpasswd) } if ( $PSBoundParameters.ContainsKey('privpasswd') ) { $payload.Add('privpasswd', $privpasswd) } if ( $PSCmdlet.ShouldProcess("$name", "Unset SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type snmpuser -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUnsetSnmpuser: Finished" } } function Invoke-ADCGetSnmpuser { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for SNMP user resource. .PARAMETER Name Name for the SNMPv3 user. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. .PARAMETER GetAll Retrieve all snmpuser object(s). .PARAMETER Count If specified, the count of the snmpuser object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpuser Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpuser -GetAll Get all snmpuser data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpuser -Count Get the number of snmpuser objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpuser -name <string> Get snmpuser object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpuser -Filter @{ 'name'='<value>' } Get snmpuser data with a filter. .NOTES File Name : Invoke-ADCGetSnmpuser Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpuser/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'GetByResource')] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Parameter(ParameterSetName = 'Get')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpuser: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpuser objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpuser -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpuser objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpuser -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpuser objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpuser -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpuser configuration for property 'name'" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpuser -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning } else { Write-Verbose "Retrieving snmpuser configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpuser -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpuser: Ended" } } function Invoke-ADCAddSnmpview { <# .SYNOPSIS Add SNMP configuration Object. .DESCRIPTION Configuration for view resource. .PARAMETER Name Name for the SNMPv3 view. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 view. .PARAMETER Subtree A particular branch (subtree) of the MIB tree that you want to associate with this SNMPv3 view. You must specify the subtree as an SNMP OID. .PARAMETER Type Include or exclude the subtree, specified by the subtree parameter, in or from this view. This setting can be useful when you have included a subtree, such as A, in an SNMPv3 view and you want to exclude a specific subtree of A, such as B, from the SNMPv3 view. Possible values = included, excluded .EXAMPLE PS C:\>Invoke-ADCAddSnmpview -name <string> -subtree <string> -type <string> An example how to add snmpview configuration Object(s). .NOTES File Name : Invoke-ADCAddSnmpview Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpview/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Subtree, [Parameter(Mandatory)] [ValidateSet('included', 'excluded')] [string]$Type ) begin { Write-Verbose "Invoke-ADCAddSnmpview: Starting" } process { try { $payload = @{ name = $name subtree = $subtree type = $type } if ( $PSCmdlet.ShouldProcess("snmpview", "Add SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type snmpview -Payload $payload -GetWarning #HTTP Status Code on Success: 201 Created #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCAddSnmpview: Finished" } } function Invoke-ADCDeleteSnmpview { <# .SYNOPSIS Delete SNMP configuration Object. .DESCRIPTION Configuration for view resource. .PARAMETER Name Name for the SNMPv3 view. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 view. .PARAMETER Subtree A particular branch (subtree) of the MIB tree that you want to associate with this SNMPv3 view. You must specify the subtree as an SNMP OID. .EXAMPLE PS C:\>Invoke-ADCDeleteSnmpview -Name <string> An example how to delete snmpview configuration Object(s). .NOTES File Name : Invoke-ADCDeleteSnmpview Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpview/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [string]$Name, [string]$Subtree ) begin { Write-Verbose "Invoke-ADCDeleteSnmpview: Starting" } process { try { $arguments = @{ } if ( $PSBoundParameters.ContainsKey('Subtree') ) { $arguments.Add('subtree', $Subtree) } if ( $PSCmdlet.ShouldProcess("$name", "Delete SNMP configuration Object") ) { $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type snmpview -NitroPath nitro/v1/config -Resource $name -Arguments $arguments #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $response } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCDeleteSnmpview: Finished" } } function Invoke-ADCUpdateSnmpview { <# .SYNOPSIS Update SNMP configuration Object. .DESCRIPTION Configuration for view resource. .PARAMETER Name Name for the SNMPv3 view. Can consist of 1 to 31 characters that include uppercase and lowercase letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at sign (@), equals (=), colon (:), and underscore (_) characters. You should choose a name that helps identify the SNMPv3 view. .PARAMETER Subtree A particular branch (subtree) of the MIB tree that you want to associate with this SNMPv3 view. You must specify the subtree as an SNMP OID. .PARAMETER Type Include or exclude the subtree, specified by the subtree parameter, in or from this view. This setting can be useful when you have included a subtree, such as A, in an SNMPv3 view and you want to exclude a specific subtree of A, such as B, from the SNMPv3 view. Possible values = included, excluded .EXAMPLE PS C:\>Invoke-ADCUpdateSnmpview -name <string> -subtree <string> -type <string> An example how to update snmpview configuration Object(s). .NOTES File Name : Invoke-ADCUpdateSnmpview Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpview/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Name, [Parameter(Mandatory)] [ValidateScript({ $_.Length -gt 1 })] [string]$Subtree, [Parameter(Mandatory)] [ValidateSet('included', 'excluded')] [string]$Type ) begin { Write-Verbose "Invoke-ADCUpdateSnmpview: Starting" } process { try { $payload = @{ name = $name subtree = $subtree type = $type } if ( $PSCmdlet.ShouldProcess("snmpview", "Update SNMP configuration Object") ) { $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type snmpview -Payload $payload -GetWarning #HTTP Status Code on Success: 200 OK #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error Write-Output $result } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" throw $_ } } end { Write-Verbose "Invoke-ADCUpdateSnmpview: Finished" } } function Invoke-ADCGetSnmpview { <# .SYNOPSIS Get SNMP configuration object(s). .DESCRIPTION Configuration for view resource. .PARAMETER GetAll Retrieve all snmpview object(s). .PARAMETER Count If specified, the count of the snmpview object(s) will be returned. .PARAMETER Filter Specify a filter. -Filter @{ 'name'='<value>' } .PARAMETER ViewSummary When specified, only a summary of information is returned. .EXAMPLE PS C:\>Invoke-ADCGetSnmpview Get data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpview -GetAll Get all snmpview data. .EXAMPLE PS C:\>Invoke-ADCGetSnmpview -Count Get the number of snmpview objects. .EXAMPLE PS C:\>Invoke-ADCGetSnmpview -name <string> Get snmpview object by specifying for example the name. .EXAMPLE PS C:\>Invoke-ADCGetSnmpview -Filter @{ 'name'='<value>' } Get snmpview data with a filter. .NOTES File Name : Invoke-ADCGetSnmpview Version : v2210.2317 Author : John Billekens Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/snmp/snmpview/ Requires : PowerShell v5.1 and up ADC 13.x and up. ADC 12 and lower may work, not guaranteed. .LINK https://blog.j81.nl #> [CmdletBinding(DefaultParameterSetName = "GetAll")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')] param( [Parameter(DontShow)] [Object]$ADCSession = (Get-ADCSession), [Parameter(ParameterSetName = 'Count', Mandatory)] [Switch]$Count, [hashtable]$Filter = @{ }, [Parameter(ParameterSetName = 'GetAll')] [Switch]$GetAll, [Parameter(ParameterSetName = 'GetAll')] [Switch]$ViewSummary ) begin { Write-Verbose "Invoke-ADCGetSnmpview: Beginning" } process { try { if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) { $query = @{ } Write-Verbose "Retrieving all snmpview objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpview -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) { if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } } Write-Verbose "Retrieving total count for snmpview objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpview -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) { Write-Verbose "Retrieving snmpview objects by arguments" $arguments = @{ } $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpview -NitroPath nitro/v1/config -Arguments $arguments -GetWarning } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) { Write-Verbose "Retrieving snmpview configuration for property ''" } else { Write-Verbose "Retrieving snmpview configuration objects" $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type snmpview -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning } } catch { Write-Verbose "ERROR: $($_.Exception.Message)" $response = $null } Write-Output $response } end { Write-Verbose "Invoke-ADCGetSnmpview: Ended" } } # SIG # Begin signature block # MIITYgYJKoZIhvcNAQcCoIITUzCCE08CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCBf7wZzg5pct4yV # AK/ayGZQcMT8NfD8gX6yaOWazME6S6CCEHUwggTzMIID26ADAgECAhAsJ03zZBC0 # i/247uUvWN5TMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYTAkdCMRswGQYDVQQI # ExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoT # D1NlY3RpZ28gTGltaXRlZDEkMCIGA1UEAxMbU2VjdGlnbyBSU0EgQ29kZSBTaWdu # aW5nIENBMB4XDTIxMDUwNTAwMDAwMFoXDTI0MDUwNDIzNTk1OVowWzELMAkGA1UE # BhMCTkwxEjAQBgNVBAcMCVZlbGRob3ZlbjEbMBkGA1UECgwSSm9oYW5uZXMgQmls # bGVrZW5zMRswGQYDVQQDDBJKb2hhbm5lcyBCaWxsZWtlbnMwggEiMA0GCSqGSIb3 # DQEBAQUAA4IBDwAwggEKAoIBAQCsfgRG81keOHalHfCUgxOa1Qy4VNOnGxB8SL8e # rjP9SfcF13McP7F1HGka5Be495pTZ+duGbaQMNozwg/5Dg9IRJEeBabeSSJJCbZo # SNpmUu7NNRRfidQxlPC81LxTVHxJ7In0MEfCVm7rWcri28MRCAuafqOfSE+hyb1Z # /tKyCyQ5RUq3kjs/CF+VfMHsJn6ZT63YqewRkwHuc7UogTTZKjhPJ9prGLTer8UX # UgvsGRbvhYZXIEuy+bmx/iJ1yRl1kX4nj6gUYzlhemOnlSDD66YOrkLDhXPMXLym # AN7h0/W5Bo//R5itgvdGBkXkWCKRASnq/9PTcoxW6mwtgU8xAgMBAAGjggGQMIIB # jDAfBgNVHSMEGDAWgBQO4TqoUzox1Yq+wbutZxoDha00DjAdBgNVHQ4EFgQUZWMy # gC0i1u2NZ1msk2Mm5nJm5AswDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAw # EwYDVR0lBAwwCgYIKwYBBQUHAwMwEQYJYIZIAYb4QgEBBAQDAgQQMEoGA1UdIARD # MEEwNQYMKwYBBAGyMQECAQMCMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGln # by5jb20vQ1BTMAgGBmeBDAEEATBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vY3Js # LnNlY3RpZ28uY29tL1NlY3RpZ29SU0FDb2RlU2lnbmluZ0NBLmNybDBzBggrBgEF # BQcBAQRnMGUwPgYIKwYBBQUHMAKGMmh0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2Vj # dGlnb1JTQUNvZGVTaWduaW5nQ0EuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2Nz # cC5zZWN0aWdvLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEARjv9ieRocb1DXRWm3XtY # jjuSRjlvkoPd9wS6DNfsGlSU42BFd9LCKSyRREZVu8FDq7dN0PhD4bBTT+k6AgrY # KG6f/8yUponOdxskv850SjN2S2FeVuR20pqActMrpd1+GCylG8mj8RGjdrLQ3QuX # qYKS68WJ39WWYdVB/8Ftajir5p6sAfwHErLhbJS6WwmYjGI/9SekossvU8mZjZwo # Gbu+fjZhPc4PhjbEh0ABSsPMfGjQQsg5zLFjg/P+cS6hgYI7qctToo0TexGe32DY # fFWHrHuBErW2qXEJvzSqM5OtLRD06a4lH5ZkhojhMOX9S8xDs/ArDKgX1j1Xm4Tu # DjCCBYEwggRpoAMCAQICEDlyRDr5IrdR19NsEN0xNZUwDQYJKoZIhvcNAQEMBQAw # ezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G # A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV # BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0xOTAzMTIwMDAwMDBaFw0y # ODEyMzEyMzU5NTlaMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKTmV3IEplcnNl # eTEUMBIGA1UEBxMLSmVyc2V5IENpdHkxHjAcBgNVBAoTFVRoZSBVU0VSVFJVU1Qg # TmV0d29yazEuMCwGA1UEAxMlVVNFUlRydXN0IFJTQSBDZXJ0aWZpY2F0aW9uIEF1 # dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIASZRc2DsPb # CLPQrFcNdu3NJ9NMrVCDYeKqIE0JLWQJ3M6Jn8w9qez2z8Hc8dOx1ns3KBErR9o5 # xrw6GbRfpr19naNjQrZ28qk7K5H44m/Q7BYgkAk+4uh0yRi0kdRiZNt/owbxiBhq # kCI8vP4T8IcUe/bkH47U5FHGEWdGCFHLhhRUP7wz/n5snP8WnRi9UY41pqdmyHJn # 2yFmsdSbeAPAUDrozPDcvJ5M/q8FljUfV1q3/875PbcstvZU3cjnEjpNrkyKt1ya # tLcgPcp/IjSufjtoZgFE5wFORlObM2D3lL5TN5BzQ/Myw1Pv26r+dE5px2uMYJPe # xMcM3+EyrsyTO1F4lWeL7j1W/gzQaQ8bD/MlJmszbfduR/pzQ+V+DqVmsSl8MoRj # VYnEDcGTVDAZE6zTfTen6106bDVc20HXEtqpSQvf2ICKCZNijrVmzyWIzYS4sT+k # OQ/ZAp7rEkyVfPNrBaleFoPMuGfi6BOdzFuC00yz7Vv/3uVzrCM7LQC/NVV0CUnY # SVgaf5I25lGSDvMmfRxNF7zJ7EMm0L9BX0CpRET0medXh55QH1dUqD79dGMvsVBl # CeZYQi5DGky08CVHWfoEHpPUJkZKUIGy3r54t/xnFeHJV4QeD2PW6WK61l9VLupc # xigIBCU5uA4rqfJMlxwHPw1S9e3vL4IPAgMBAAGjgfIwge8wHwYDVR0jBBgwFoAU # oBEKIz6W8Qfs4q8p74Klf9AwpLQwHQYDVR0OBBYEFFN5v1qqK0rPVIDh2JvAnfKy # A2bLMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MBEGA1UdIAQKMAgw # BgYEVR0gADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vY3JsLmNvbW9kb2NhLmNv # bS9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDA0BggrBgEFBQcBAQQoMCYwJAYI # KwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTANBgkqhkiG9w0BAQwF # AAOCAQEAGIdR3HQhPZyK4Ce3M9AuzOzw5steEd4ib5t1jp5y/uTW/qofnJYt7wNK # fq70jW9yPEM7wD/ruN9cqqnGrvL82O6je0P2hjZ8FODN9Pc//t64tIrwkZb+/UNk # fv3M0gGhfX34GRnJQisTv1iLuqSiZgR2iJFODIkUzqJNyTKzuugUGrxx8VvwQQuY # AAoiAxDlDLH5zZI3Ge078eQ6tvlFEyZ1r7uq7z97dzvSxAKRPRkA0xdcOds/exgN # Rc2ThZYvXd9ZFk8/Ub3VRRg/7UqO6AZhdCMWtQ1QcydER38QXYkqa4UxFMToqWpM # gLxqeM+4f452cpkMnf7XkQgWoaNflTCCBfUwggPdoAMCAQICEB2iSDBvmyYY0ILg # ln0z02owDQYJKoZIhvcNAQEMBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpO # ZXcgSmVyc2V5MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVT # RVJUUlVTVCBOZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmlj # YXRpb24gQXV0aG9yaXR5MB4XDTE4MTEwMjAwMDAwMFoXDTMwMTIzMTIzNTk1OVow # fDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G # A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMSQwIgYDVQQD # ExtTZWN0aWdvIFJTQSBDb2RlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUA # A4IBDwAwggEKAoIBAQCGIo0yhXoYn0nwli9jCB4t3HyfFM/jJrYlZilAhlRGdDFi # xRDtsocnppnLlTDAVvWkdcapDlBipVGREGrgS2Ku/fD4GKyn/+4uMyD6DBmJqGx7 # rQDDYaHcaWVtH24nlteXUYam9CflfGqLlR5bYNV+1xaSnAAvaPeX7Wpyvjg7Y96P # v25MQV0SIAhZ6DnNj9LWzwa0VwW2TqE+V2sfmLzEYtYbC43HZhtKn52BxHJAteJf # 7wtF/6POF6YtVbC3sLxUap28jVZTxvC6eVBJLPcDuf4vZTXyIuosB69G2flGHNyM # fHEo8/6nxhTdVZFuihEN3wYklX0Pp6F8OtqGNWHTAgMBAAGjggFkMIIBYDAfBgNV # HSMEGDAWgBRTeb9aqitKz1SA4dibwJ3ysgNmyzAdBgNVHQ4EFgQUDuE6qFM6MdWK # vsG7rWcaA4WtNA4wDgYDVR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAw # HQYDVR0lBBYwFAYIKwYBBQUHAwMGCCsGAQUFBwMIMBEGA1UdIAQKMAgwBgYEVR0g # ADBQBgNVHR8ESTBHMEWgQ6BBhj9odHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVNF # UlRydXN0UlNBQ2VydGlmaWNhdGlvbkF1dGhvcml0eS5jcmwwdgYIKwYBBQUHAQEE # ajBoMD8GCCsGAQUFBzAChjNodHRwOi8vY3J0LnVzZXJ0cnVzdC5jb20vVVNFUlRy # dXN0UlNBQWRkVHJ1c3RDQS5jcnQwJQYIKwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVz # ZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggIBAE1jUO1HNEphpNveaiqMm/EA # AB4dYns61zLC9rPgY7P7YQCImhttEAcET7646ol4IusPRuzzRl5ARokS9At3Wpwq # QTr81vTr5/cVlTPDoYMot94v5JT3hTODLUpASL+awk9KsY8k9LOBN9O3ZLCmI2pZ # aFJCX/8E6+F0ZXkI9amT3mtxQJmWunjxucjiwwgWsatjWsgVgG10Xkp1fqW4w2y1 # z99KeYdcx0BNYzX2MNPPtQoOCwR/oEuuu6Ol0IQAkz5TXTSlADVpbL6fICUQDRn7 # UJBhvjmPeo5N9p8OHv4HURJmgyYZSJXOSsnBf/M6BZv5b9+If8AjntIeQ3pFMcGc # TanwWbJZGehqjSkEAnd8S0vNcL46slVaeD68u28DECV3FTSK+TbMQ5Lkuk/xYpMo # JVcp+1EZx6ElQGqEV8aynbG8HArafGd+fS7pKEwYfsR7MUFxmksp7As9V1DSyt39 # ngVR5UR43QHesXWYDVQk/fBO4+L4g71yuss9Ou7wXheSaG3IYfmm8SoKC6W59J7u # mDIFhZ7r+YMp08Ysfb06dy6LN0KgaoLtO0qqlBCk4Q34F8W2WnkzGJLjtXX4oemO # CiUe5B7xn1qHI/+fpFGe+zmAEc3btcSnqIBv5VPU4OOiwtJbGvoyJi1qV3AcPKRY # LqPzW0sH3DJZ84enGm1YMYICQzCCAj8CAQEwgZAwfDELMAkGA1UEBhMCR0IxGzAZ # BgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEYMBYG # A1UEChMPU2VjdGlnbyBMaW1pdGVkMSQwIgYDVQQDExtTZWN0aWdvIFJTQSBDb2Rl # IFNpZ25pbmcgQ0ECECwnTfNkELSL/bju5S9Y3lMwDQYJYIZIAWUDBAIBBQCggYQw # GAYKKwYBBAGCNwIBDDEKMAigAoAAoQKAADAZBgkqhkiG9w0BCQMxDAYKKwYBBAGC # NwIBBDAcBgorBgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQx # IgQgEKaLrHEmru0a299lBX93Kv5Q2mNTztdUaHooqNDi/hMwDQYJKoZIhvcNAQEB # BQAEggEAYFIbpywd23Uww5HfQ6rCbq1RgKrFCvUE7neHU1/FkAFTaCmlt1v3sK4s # DUrEo3t9/SQXFm2d8qzUPndkJG5bNsvt/uTfegKqVlkqJxuHEmNUO4CGzUshTxsZ # qyNtJOLVQ/praVNqKmhvVUxyH/dNSDihG4/PvyTdb6uolXXktoWj9wHqTZyppfL1 # NeHVwrjqOrCwwJdrJNs/2n3h3uDI0mv5Y63aI2rUIqcw3bewYybwm7Mr1SqIxqB9 # 7R8Vd0Ts4vMyhCmHRJgAGMqd/lX97AWru2Y8yjrc6AOsJjHLCPQ4BeF3p3BYHsSc # sxCeKSKdszWoHuyjvd/t0Jk1FMOtzQ== # SIG # End signature block |