Src/Private/Get-AbrOntapSysConfigEMSSettings.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
function Get-AbrOntapSysConfigEMSSetting {
    <#
    .SYNOPSIS
        Used by As Built Report to retrieve NetApp ONTAP System EMS Settings information from the Cluster Management Network
    .DESCRIPTION

    .NOTES
        Version: 0.6.3
        Author: Jonathan Colon
        Twitter: @jcolonfzenpr
        Github: rebelinux
    .EXAMPLE

    .LINK

    #>

    [CmdletBinding()]
    param (
    )

    begin {
        Write-PscriboMessage "Collecting ONTAP System EMS Settings information."
    }

    process {
        try {
            $Data =  Get-NcEmsDestination -Controller $Array
            $OutObj = @()
            if ($Data) {
                foreach ($Item in $Data) {
                    try {
                        $inObj = [ordered] @{
                            'Name' = $Item.Name
                            'Email Destinations' = Switch ($Item.Mail) {
                                $Null { '-' }
                                default { $Item.Mail }
                            }
                            'Snmp Traphost' = Switch ($Item.Snmp) {
                                $Null { '-' }
                                default { $Item.Snmp }
                            }
                            'Snmp Community' = Switch ($Item.SnmpCommunity) {
                                $Null { '-' }
                                default { $Item.SnmpCommunity }
                            }
                            'Syslog' = Switch ($Item.Syslog) {
                                $Null { '-' }
                                default { $Item.Syslog }
                            }
                            'Syslog Facility' = Switch ($Item.SyslogFacility) {
                                $Null { '-' }
                                default { $Item.SyslogFacility }
                            }
                        }
                        $OutObj += [pscustomobject]$inobj
                    }
                    catch {
                        Write-PscriboMessage -IsWarning $_.Exception.Message
                    }
                }

                $TableParams = @{
                    Name = "System EMS Configuration Setting - $($ClusterInfo.ClusterName)"
                    List = $false
                    ColumnWidths = 17, 30, 15, 13, 15, 10
                }
                if ($Report.ShowTableCaptions) {
                    $TableParams['Caption'] = "- $($TableParams.Name)"
                }
                $OutObj | Table @TableParams
            }
        }
        catch {
            Write-PscriboMessage -IsWarning $_.Exception.Message
        }
        try {
            $Data =  Get-NcAudit -Controller $Array
            if ($Data) {
                Section -Style Heading4 "Audit Settings" {
                    Paragraph "The following section provides information about Audit Setting from $($ClusterInfo.ClusterName)."
                    BlankLine
                    $OutObj = @()
                    foreach ($Item in $Data) {
                        try {
                            $inObj = [ordered] @{
                                'Enable HTTP Get request' = ConvertTo-TextYN $Item.HttpGet
                                'Enable ONTAPI Get request' = ConvertTo-TextYN $Item.OntapiGet
                                'Enable CLI Get request' = ConvertTo-TextYN $Item.CliGet
                            }
                            $OutObj += [pscustomobject]$inobj
                        }
                        catch {
                            Write-PscriboMessage -IsWarning $_.Exception.Message
                        }
                    }

                    $TableParams = @{
                        Name = "Audit Settings - $($ClusterInfo.ClusterName)"
                        List = $true
                        ColumnWidths = 40, 60
                    }
                    if ($Report.ShowTableCaptions) {
                        $TableParams['Caption'] = "- $($TableParams.Name)"
                    }
                    $OutObj | Table @TableParams
                    try {
                        $Data =  Get-NcClusterLogForward -Controller $Array
                        if ($Data) {
                            Section -Style Heading4 "Audit Log Destinations" {
                                $OutObj = @()
                                foreach ($Item in $Data) {
                                    try {
                                        $inObj = [ordered] @{
                                            'Destination' = $Item.Destination
                                            'Facility' = $Item.Facility
                                            'Port' = $Item.Port
                                            'Protocol' = $Item.Protocol
                                            'Server Verification' = ConvertTo-TextYN $Item.VerifyServerSpecified
                                        }
                                        $OutObj += [pscustomobject]$inobj
                                    }
                                    catch {
                                        Write-PscriboMessage -IsWarning $_.Exception.Message
                                    }
                                }

                                $TableParams = @{
                                    Name = "Audit Log Destinations - $($ClusterInfo.ClusterName)"
                                    List = $false
                                    ColumnWidths = 20, 20, 20, 20, 20
                                }
                                if ($Report.ShowTableCaptions) {
                                    $TableParams['Caption'] = "- $($TableParams.Name)"
                                }
                                $OutObj | Table @TableParams
                            }
                        }
                    }
                    catch {
                        Write-PscriboMessage -IsWarning $_.Exception.Message
                    }
                }
            }
        }
        catch {
            Write-PscriboMessage -IsWarning $_.Exception.Message
        }
    }

    end {}

}