I had a customer who wanted to read boottime information from a XML file generated by xperf into Foglight after every reboot. There might be a couple of solutions for this. Here is an example how to do things like that with a script agent using powershell. Powershell offers features that makes the navigation in a XML file much easier.
First of all it is necessary to enable the poweshell script execution on the windows boxes by excuting the command "Set-ExecutionPolicy unrestricted" at the powershell commandline.
NOTE: Sometimes the 32Bit and the 64Bit version of powershell is installed at the same time. You should execute this command in both enviroments to make sure that the agent will run. You have to excute this as administrator!
A helpful tool to find the values and analyze the structure of a XML file is the XML-Notepad. It is free for download from Microsoft.
If you would like to read the value from "bootDoneViaExplorer" you should use the path "results.boot.timing.bootDoneViaExplorer". Here is a simple example of using this in a powershell script. $verzeichnis is the path and the name of the XML file e.g. C:\Kunden\Continental\neu\boot_1.xml:
---------------------------------------------------------
Param(
[string]$verzeichnis
)
[xml]$test = Get-Content "$verzeichnis"
$res1 = $test.results.boot.timing.bootDoneViaPostBoot
$res2 = $test.results.boot.timing.bonotDoneViaExplorer
$res3 = $test.results.boot.timing.interval[2].winlogon.notification[0].startTime
$res4 = $test.results.boot.timing.interval[2].winlogon.notification[0].endTime
$out = $test.results.boot.processSummary.unexpectedShortlived.process | where-object{$_.name -eq "CMIGuiServer.exe"}| %{$_.lifetime -replace ' ', ''}
if (!$out) {$res5 = "0"}
else {$res5 = $out.TrimStart("lifetime")}
$out = $test.results.boot.services.serviceTransition | where-object {$_.name -eq "McAfeeFramework"}| findstr "totalTransitionTimeDelta" | %{$_ -replace ' ', ''} | %{$_ -replace ':',''}
if (!$out) {$res6 = "0"}
else {$res6 = $out.TrimStart("totalTransitionTimeDelta")}
$out = $test.results.boot.services.serviceTransition | where-object {$_.name -eq "LANDesk Targeted Multicast"}| findstr "totalTransitionTimeDelta" | %{$_ -replace ' ', ''} | %{$_ -replace ':',''}
if (!$out) {$res7 = "0"}
else {$res7 = $out.TrimStart("totalTransitionTimeDelta")}
echo "TABLE BootInfo"
echo "START_SAMPLE_PERIOD"
echo "bootDoneViaPostBoot:millisecond = $res1"
echo "bootDoneViaExplorer:millisecond = $res2"
echo "CreateSessionStartTime:millisecond = $res3"
echo "CreateSessionEndTime:millisecond = $res4"
echo "CMIGuiLifeTime:millisecond = $res5"
echo "McAfeeTTTDelta:millisecond = $res6"
echo "LanDeskTTTDelta:millisecond = $res7"
echo "END_SAMPLE_PERIOD"
echo "END_TABLE"
-------------------------------------------------------
Powershell scripts have the extension .PS1. To call this script as an agent from Foglight it is necessary to do that with a .bat file. In this case the bat file should look like this.
-------------------------------------------------------
@echo off
if not "%ECHO%"=="" echo %ECHO%
if not "%OS%"=="Windows_NT" goto EXIT
if "%sample_freq%"=="" set sample_freq=60
powershell.exe .\bootcheck.ps1 -verzeichnis \"%VerzeichnisXML%\" < NUL
-------------------------------------------------------
NOTE: I used Stefans IDE cartridge to create the agent as a car file using the ASP %Verzeichnis% for the directory and filename of the XML file. The directory information can als be in the bat file, like:
powershell.exe .\bootcheck.ps1 -verzeichnis "C:\Kunden\Continental\neu\boot_1.xml" < NUL
After that you should buil dashboards, rules etc. for the agent.