Ad Widget

Collapse

MSSQL Integration Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • heshammhafez
    Junior Member
    • Apr 2020
    • 3

    #1

    MSSQL Integration Problem

    Hello Guys,

    I'm trying to integrate MSSQL with zabbix first all perfcounter items were in NOT SUPPORTED state after long troubleshooting I noticed that all keys are using wrong variable $INST and in my case I should use $PERFCOUNTERNAME, this is a sample of one of the keys related to the template I'm using perf_counter["\MSSQL$MSSQLSERVER:Access Methods\Page Splits/sec". I double checked the script responsible for these variables and I found that I'm stuck in else part


    $obj = [PSCustomObject] @{
    data = @((get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server').InstalledInstances | % {
    [PSCustomObject] @{
    '{#INST}' = $_
    '{#PERFCOUNTERNAME}' = if($_ -eq 'MSSQLSERVER') { "SQLServer" } else { "MSSQL`$$_" }
    }
    })
    }
    Write-Host $($obj | ConvertTo-Json)

    I tried to edit the key to perf_counter["\$PERFCOUNTERNAME:Access Methods\Page Splits/sec"] but it didn't work, the correct value to work should be SQLServer but I don't want it to be hard coded and do it manually one by one

    this is the output of get-itemproperty 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server'

    SsrpActiveServer :
    InstalledInstances : {MSSQLSERVER}
    PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MAC HINE\SOFTWARE\Microsoft\Microsoft SQL Server
    PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MAC HINE\SOFTWARE\Microsoft
    PSChildName : Microsoft SQL Server
    PSDrive : HKLM


    can anyone help on this ?

    Regards,
Working...