In this tutorial, it is described how to configure Hard Disk Sentinel to create and automatically update an XML file which contains all detected status information, including but not limited to
the complete status of all hard disks, SSD, SSHDs, RAID arrays and all storage devices
detailed information about supported and enabled features of the disk drives
temperature, health, performance, text description of each devices which contain any possible error(s) displayed in Hard Disk Sentinel
generic hardware information (CPU count and type, usage, RAM / swapfile usage, list of devices)
generic system information (network address, system uptime, idle time)
and so.
The created XML file can be read, processed by any third party application, script - and this allows integrators, developers to display, store, process any detected information and make custom actions, logging based on that.
Generally the information in the XML file is similar which saved in a text / HTML report (saved by using the Report menu in Hard Disk Sentinel), just in different XML format.
Registered (complete) Hard Disk Sentinel version required to be installed.
Enable Configuration -> Advanced Options -> Generate and update XML file. By default, this saves HDSentinel.xml file in the folder where the software installed. By the button next to the option, it is possible to select the target location of the XML file. The XML file updated automatically based on the configured detection frequency (which can be adjusted by the slider on the top of the Advanced Options page, by default once per every 5 minutes).
Alternatively, the complete status in XML reports can be read over the network (internet) via HTTP, from any web browser or tool downloading web traffic (for example wget). For this, please enable Configuration -> Integration -> Enable WebStatus option - and then it is possible to read the complete report by entering http://computer-name:61220/xml in any web browser, where computer-name is the name (or IP address) of the actual computer.
The created XML report can be read, processed differently based on the actual requirements. There are Add-ons available, using this technique, for example the Remote PC status gadget and the Nagios integration.
Just open notepad, copy/paste the following code and save the file as hdsentinel-xml-demo.vbs in the folder where Hard Disk Sentinel saves the XML file. Then double-clicking on the hdsentinel-xml-demo.vbs file (or by starting cscript hdsentinel-xml-demo.vbs) gives the details from the XML file.
Set xmlDoc = CreateObject("Microsoft.XMLDOM") xmlDoc.Async = "False" xmlDoc.Load("HDSentinel.xml") For count=0 to 255 Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Hard_Disk_Model_ID") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Model ID : "&objNode.Text Next Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Hard_Disk_Serial_Number") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Serial Number: "&objNode.Text Next Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Interface") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Interface : "&objNode.Text Next Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Current_Temperature") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Temperature : "&objNode.Text Next Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Health") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Health : "&objNode.Text Next Set colNodes = xmlDoc.selectNodes _ ("/Hard_Disk_Sentinel/Physical_Disk_Information_Disk_"&count&"/Hard_Disk_Summary/Performance") For Each objNode in colNodes Wscript.Echo "Disk "&count&" Performance : "&objNode.Text Next Next
Sample output:
Quote from Ken Wallewein (Thanks for his hard work and sharing the information): "PRTG offers direct XML reading functionality. Here's some example PowerShell code that shows the XML need. "
Reads from URL, writes to SYS$OUTPUT
Requires Powershell 3 or 4 (?)
$result = Invoke-WebRequest -Uri "http://kmbdr1:61220/xml" -ErrorAction SilentlyContinue -UseBasicParsing if ($result.StatusCode -ne 200){ write-host "" write-host " " Exit } [xml] $xdoc = $result.Content ## Write-Output $result.Content ## Write-Output $xdoc Write-Output "1 " write-host "HTTP Request Failed " write-host "" foreach ($xmlnode in $xdoc.Hard_Disk_Sentinel.Childnodes.Hard_Disk_Summary) { Write-Output " "" Write-Output " " } Write-Host "$($xmlnode.Hard_Disk_Serial_Number) " Write-Output "$($xmlnode.Health) " Write-Output "1 " Write-Output "
It may be good idea to combine XML output with other functions, for example the WMI function, when status information can be read by WMI queries, from local or remote computer.
Also it is good solution to use Hard Disk Sentinel in service mode. This way the software runs in the background "silently" as NT Service and without affecting the current user, it is possible to use these functions to detect and read/parse/process the collected status information (in addition to possible other options, for example alerts), making ideal solution to monitor status of computers where users have limited user rights only - or even computers (servers) where there is no active user at all.
Feel free to submit questions, suggestions or possible other requirements to info (at) hdsentinel (dot) com e-mail address. If you create and want to share 3rd party add-on(s) based on this function, feel free to contact and it can be added to the Add-ons page to help other users too.