Hallo, ich habe ein XML File mit Werten meiner Raid-Disks. Diese möchte ich in PRTG anzeigen lassen. Anbei das PS1 File.
$result = Invoke-WebRequest -Uri "http://micms01.metob2k.local:61220/xml" -ErrorAction SilentlyContinue -UseBasicParsing if ($result.StatusCode -ne 200){ write-host "<prtg>" write-host "<error>1</error>" write-host "<text>HTTP Request Failed</text>" write-host "</prtg>" Exit } [xml] $xdoc = $result.Content ## Write-Output $result.Content ## Write-Output $xdoc Write-Output "<prtg>" foreach ($xmlnode in $xdoc.Hard_Disk_Sentinel.Childnodes.Hard_Disk_Summary) { Write-Output "<result>" Write-Output "<channel>$($xmlnode.Hard_Disk_Serial_Number)</channel>" Write-Output "<value>$($xmlnode.Health)</value>" Write-Output "<float>1</float>" Write-Output "</result>" } Write-Host "</prtg>"
Es erscheint in PRTG Anwort nicht wohlgeformt. Die Werte stehen aber in der Meldung drin. Anbei das LogFile des Sensors.
Result of Sensor 8572-Data Data['fastcount'].asString := '0'; Data['valuetype'].asString := '0'; Data['resultfile'].asString := 'Result of Sensor 8572.txt'; Data['windowsloginusername'].asString := 'administrator'; Data['hostv6'].asString := ''; Data['blockedsens'].asString := ''; Data['tlsexplicit_default'].asString := ''; Data['channelnames'].asString := 'Ausführungsdauer'#$D#$A + '1'#$D#$A + ''; Data['vmwareparams'].asString := '1'; Data['isexesensor'].asString := '1'; Data['windowsloginpassword'].asString := '***'; Data['scriptplaceholder3'].asString := ''; Data['reboot'].asString := '44858.350468206'; Data['scriptplaceholder1'].asString := ''; Data['exeparamshash'].asString := 'da39a3ee5e6b4b0d3255bfef95601890afd80709'; Data['tlsexplicit_port'].asString := ''; Data['monitorchange'].asString := '0'; Data['inerror'].asString := '1'; Data['scriptplaceholder4'].asString := ''; Data['host'].asString := '192.168.30.49'; Data['unit'].asString := '#'; Data['tlsexplicit_ftp'].asString := ''; Data['timeout'].asString := '60'; Data['notonpod'].asString := '0'; Data['momopersistent'].asString := ''; Data['linuxloginpassword'].asString := ''; Data['exefile'].asString := 'micms01raid7.ps1'; Data['lastuptime'].asString := '0'; Data['writeresult'].asString := '1'; Data['reqmsginterval'].asString := '60'; Data['windowslogindomain'].asString := 'metob2k'; Data['tlsexplicit_imap'].asString := ''; Data['channel'].asString := 'Wert'; Data['uptimecount'].asString := '0'; Data['canlinux'].asString := '1'; Data['channelinfos'].asString := '{"1":{"Unit":"oukTimeResponse","CustomUnit":"","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""}}'; Data['environment'].asString := ''; Data['mutexname'].asString := ''; Data['scriptplaceholder5'].asString := ''; Data['usednstime'].asString := '0'; Data['newpowershell'].asString := '0'; Data['linuxlogindomain'].asString := ''; Data['sensorid'].asString := '8572'; Data['ipversion'].asString := '0'; Data['tlsexplicit_smtp'].asString := ''; Data['scriptplaceholder2'].asString := ''; Data['usewindowsauthentication'].asString := '1'; Data['simulate'].asString := '0'; Data['exeparams'].asString := ''; Data['lastmsg'].asString := '#O132 (<prtg> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel>S4X6NF0N302313K</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T100958Z</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T346477Y</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T406148R</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T413055E</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T402437M</channel> <value>100 %</value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> </prtg> )'; Data['tlsexplicit_pop3'].asString := '';
Datei Result of Sensor 8572.txt
<prtg> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel>S4X6NF0N302313K</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T100958Z</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T346477Y</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T406148R</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T413055E</channel> <value>100 %</value> <float>1</float> </result> <result> <channel>S6PUNM0T402437M</channel> <value>100 %</value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> <result> <channel></channel> <value></value> <float>1</float> </result> </prtg>
Kann mir bitte jemand helfen, wo der Fehler liegt ? Vielen Dank vorab.
Grüße
Olli
Add comment