Opennms MSSQL & Opennms Upgrade

  • Category: 電腦相關
  • Last Updated: Tuesday, 10 January 2017 17:32
  • Published: Thursday, 22 September 2016 11:04
  • Written by sam

剛好公司採用MS方案

多了試試MS的偵測方式

opennms,service

使用自訂服務監視Windows系統服務及埠號狀態

編輯

vi /etc/opennms/poller-configuration.xml
<service name="MSSQLSERVER" interval="3000000" user-defined="false" status="on">
            <parameter key="retry" value="1"/>
            <parameter key="timeout" value="3000"/>
            <parameter key="port" value="1433"/>
            <parameter key="service-name" value="MSSQLSERVER"/>
</service>
<service name="MSSQL-Agent" interval="300000" user-defined="false" status="on">
        <parameter key="retry" value="2" />
        <parameter key="timeout" value="6000" />
        <parameter key="matchType" value="all" />
        <parameter key="wmiNamespace" value="root/cimv2" />
        <parameter key="wmiClass" value="Win32_Service" />
        <parameter key="wmiWqlStr" value="select State from Win32_Service where Name='SQLSERVERAGENT'" />
        <parameter key="wmiObject" value="State" />
        <parameter key="compareOp" value="EQ" />
        <parameter key="compareValue" value="Running" />
        <parameter key="service-name" value="MSSQL-Agent" />
</service>

再附上一個設定檔

<detector name="MSSQLSERVER" class="org.opennms.netmgt.provision.detector.simple.TcpDetector">
         <parameter key="port" value="1433"/>
</detector>
<detector name="MSSQL-Agent" class="org.opennms.netmgt.provision.detector.wmi.WmiDetector">
         <parameter key="compVal" value="Running"/>
         <parameter key="matchType" value="all"/>
         <parameter key="compOp" value="EQ"/>
         <parameter key="retries" value="2"/>
         <parameter key="wmiObject" value="State"/>
         <parameter key="wmiWqlStr" value="select State from Win32_Service where Name='SQLSERVERAGENT'"/>
         <parameter key="serviceName" value="MSSQL-Agent"/>
         <parameter key="timeout" value="6000"/>
</detector>

這邊見到分別為兩種作業方式

第一種為PORT號的偵測

第二種為SERVICE方式偵測(必需先完成WMI的前置作業,才撈的到資料)

類似方法及指令測試,可以採用GWMI的方式測試(類SQL指令,可先在POWERSHELL試查詢)

gwmi,powershell

當然,在 "Provisioning Requisitions"也要記得去新增

才會抓的到服務並監控它

如此…應該所有的服務都能監視了

目前的缺點就是在WMI收集的資訊仍是有問題

但是是發生在

vi /etc/opennms/datacollection/wmi.xml

目前的自定仍是抓不到資料…導致沒有辦法作

vi /etc/opennms/thresholds.xml

仍待努力

再加上原本的測試方式

/usr/share/opennms/bin/checkwmi -matchType all -wmiClass Win32_PerfFormattedData_MSSQLSERVER_SQLServerLocks -wmiObject NumberofDeadlocksPersec -op EQ -value 0 -wmiWql "select NumberofDeadlocksPersec from Win32_PerfFormattedData_MSSQLSERVER_SQLServerLocks where Name='_Total'" IP ACC PW

results

Checking: select NumberofDeadlocksPersec from Win32_PerfFormattedData_MSSQLSERVER_SQLServerLocks where Name='_Total' for NumberofDeadlocksPersec Op: EQ Val: 0
Check results: OK (1)
Result for (1) Win32_PerfFormattedData_MSSQLSERVER_SQLServerLocks\NumberofDeadlocksPersec: 0

############################################################

apt list --upgradable
systemctl stop opennms.service

今天發現有更新啦

backup DB

backup DIR

apt-get install --only-upgrade opennms


############################################################

MSSQL 幾項指標觀察

opennms,thresholds

OpenNMS
lockwaittimems,deadlockspersec,FreeMemoryKB,UserConnections