The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.15 (Linux)
File Line Function
/showthread.php 895 errorHandler->error


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Module stays in "Not Initialized"
#1
Hi! I wrote a new module yesterday that detects, if a Windows NIC works in 1 GBit or in 100 MBit mode. It's status is NORMAL, if it is in 1 GBit mode, CRITICAL otherwise. The data is transmitted from the agent to the server -- I get a "data graph" which contains the right values. But the modules is shown as "Not Initialized" and does not show up. All my other modules work fine.

configuration in pandora_agent.conf :
module_plugin cscript.exe //B "c:\Program Files\pandora_agent\util\nic.vbs"

output:
<module>
<name><![CDATA[NIC_Speed]]></name>
<type><![CDATA[generic_data]]></type>
<description><![CDATA[NIC Connect Speed of Realtek PCIe GBE Family Controller]]></description>
<unit><![CDATA[MBit/s]]></unit>
<module_group><![CDATA[Networking]]></module_group>
<data><![CDATA[1000]]></data>
<status><![CDATA[NORMAL]]></status>
</module>

nic.vbs:
' Agent Plugin to get network adapter info
' Execute as module_plugin cscript //B nic.vbs

Option Explicit

Dim strComputer, objWMIService, colItems, objItem, Speed, Name, Status

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkAdapter WHERE NetEnabled='True' AND NOT Name LIKE '%VMware%' ")

on error resume next

For Each objItem in colItems

Speed=objItem.Speed / 1000000
Name=objItem.Name

Status="UNKNOWN"

if Speed=1000 then
Status="NORMAL"
elseif Speed=100 then
Status="CRITICAL"
else
Status="UNKNOWN"
end if

WScript.StdOut.WriteLine "<module>"
WScript.StdOut.WriteLine " <name><![CDATA[NIC_Speed]]></name>"
WScript.StdOut.WriteLine " <type><![CDATA[generic_data]]></type>"
WScript.StdOut.WriteLine " <description><![CDATA[NIC Connect Speed of " & Name & "]]></description>"
WScript.StdOut.WriteLine " <unit><![CDATA[MBit/s]]></unit>"
WScript.StdOut.WriteLine " <module_group><![CDATA[Networking]]></module_group>"
WScript.StdOut.WriteLine " <data><![CDATA[" & Speed & "]]></data>"
WScript.StdOut.WriteLine " <status><![CDATA[" & Status & "]]></status>"
WScript.StdOut.WriteLine "</module>"

Next

WScript.Quit 0
 Reply
Messages In This Thread
Module stays in "Not Initialized" - by annomatik - 01-26-2020, 04:57 PM


Users browsing this thread: 1 Guest(s)


(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes