Retrieve ProxySG key resources via SNMP in Microsoft Powershell
search cancel

Retrieve ProxySG key resources via SNMP in Microsoft Powershell

book

Article ID: 226694

calendar_today

Updated On:

Products

ProxySG Software - SGOS

Issue/Introduction

How to pull via SNMP specific Edge SWG key resources like CPU, Memory Utilization, etc from Microsoft Windows Powershell and write the output in a text file.

Resolution

In the Microsoft PowerShell console please execute the following commands (script), amend it as per requirements:

  • <# PowerShell Get proxy specific OIDs#>
    $SNMP = New-Object -ComObject olePrn.OleSNMP
    $snmp.open('proxysg.test.local','myproxyCommunity',2,1000)

    $proxyRelease=$snmp.get('.1.3.6.1.4.1.3417.2.11.1.3.0')
    $proxySN=$snmp.get('.1.3.6.1.4.1.3417.2.11.1.4.0')
    $proxyCPU=$snmp.get('.1.3.6.1.4.1.3417.2.4.1.1.1.4.1')
    $proxyCPUIdleTime=$snmp.get('.iso.org.dod.internet.private.enterprises.3417.2.11.2.4.1.9.2')
    $proxyMemCommitted=$snmp.get('.1.3.6.1.4.1.3417.2.11.2.3.4.0')
    $proxyInt1ut=$snmp.get('.1.3.6.1.4.1.3417.2.4.1.1.1.4.2')
    $proxyNumObjCache=$snmp.get('.iso.org.dod.internet.private.enterprises.3417.2.11.2.2.2.0')

    "Proxy OS Version = " + $proxyRelease | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy Serial Number = " + $proxySN | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy CPU Utilisation = " + $proxyCPU | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy CPU Idle Time = " + $proxyCPUIdleTime | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy Memory Committed = " + $proxyMemCommitted | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy Interface 1 utilization = " + $proxyInt1ut | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append
    "Proxy Num Objects in cache = " +$proxyNumObjCache | Tee-Object C:\Users\testuser\Documents\WindowsPowerShell\proxyOIDs.log -Append

Practical execution and output example:

Please replace below script line host with target proxy FQDN or IP address and "myproxyCommunity" with community set in the proxy SNMP settings:

  • $snmp.open('proxysg.test.local','myproxyCommunity',2,1000)