Any better ways to monitor Intel AMT?

Votes:

1

Your Vote:

Up

Down

For a simple check to make sure no one has stolen or disconnected a lab computer we have setup a custom sensor.

Simple batch file:

----------------------------------

@ECHO OFF

set host=%1

c:\progra~2\PRTGNE~1\custom~1\exe\remotecontrol.exe -p -user admin -pass abc!123AB http://%host%:16992/RemoteControlService |find.exe "SystemPowerstate"

IF NOT errorlevel=1 ECHO 200:AMT On

Exit 0 

IF errorlevel=1 ECHO 100:No Connection

Exit 1 

-----------------------------------

We pulled Remotecontrol.exe and the required library StatusStrings.dll out of Intel's SDK files found at http://software.intel.com/en-us/articles/download-the-latest-intel-amt-software-development-kit-sdk/

It works to monitor individual lab computers attached to the network when they are powered off (if the PC supports Intel Vpro / AMT and is configured correctly).

Just wondering if anyone had a better way or had something already cooked up. I'd love to get more information then just "connected / not connected" but at the moment thats all my customer sensor will do.

Any thoughts would be great.

Cheers! - Andrew

custom-exe custom-sensor sensor

Created on Oct 16, 2010 6:06:31 AM by  Andrew Brigham (101) 1 1

Last change on Oct 18, 2010 1:25:51 PM by  Torsten Lindner [Paessler Support] (19,480) 3 1



3 Replies

Votes:

1

Your Vote:

Up

Down

There are many ways to monitor AMT systems via a script.

  • Thrid idea: There's a powershell module for AMT: http://communities.intel.com/docs/DOC-5403. Basides the basics (power state, HW inventory, etc) this includes access to the 3rd party data store. Although I have not tried this yet, in theory you could write log data into 3PDS locally and the read it out remotely, even if the system is off.
  • Fourth idea: Use AMT's webUI from the command line with CURL. I've done this to automate AMT testing. Anything that's in the WebUI can be read calling the page and then parsing the html results.
  • Fifth idea: Configure AMT to send PET events. This is a bit more complicated, but for SMB mode I could give you a code sample in vbscript if you're interested. This way AMT would alert you if, for example, someone opened the case on the computer or everytime AMT gets a "link up" (Nic plugged in or reboot)
  • Sixth idea: Check out the other tools in the AMT SDK. amtredirection.exe is fun. With a vbscript, I've been able to automate IDER boots.

I'm sure there are loads of other "do it yourself" options.

BTW - did you figure out, yet, that I work for Intel and am called the "vPro Uber Geek"?

Created on Oct 20, 2010 8:18:07 PM by  jake_friz (10)

Last change on Oct 21, 2010 11:38:24 AM by  Torsten Lindner [Paessler Support] (19,480) 3 1



Votes:

1

Your Vote:

Up

Down

I have attached some .asp code that can be used with a web page. It also uses RemoteControl.exe to query the remote AMT client. It will print out the power state including sleep and hibernate. Just create a form on a webpage that calls this .asp and passes along the 'hostname' tag with the fqdn or ip address of the client.

<%@ Language=VBScript %>
<%
dim strFQDN
strFQDN = Request.Form("HostName")
%>

<HTML>
<HEAD>
<TITLE>vPro Demo Administration</TITLE>
</HEAD>

<BODY BGCOLOR = FFFFFF>

<%

' Program constants and variables
const strUser = "admin"
const strPass = "P@ssw0rd"
const ForReading = 1, ForWriting = 2, ForAppending = 8
const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
dim objShell : Set objShell = nothing
dim objFSO : Set objFSO = nothing
dim objOutFile : Set objOutFile = nothing
dim objTextStream : Set objTextStream = nothing
dim strCMD
dim strLine, strTMP
dim strMessage
dim strPhysPath

' Initialize the shell to run a command and to access the file system
Set objShell = CreateObject("WScript.shell") 
Set objFSO = CreateObject("Scripting.FileSystemObject")

' Make sure there is a HostName
if strFQDN = "" then
	ErrorExit("No Host Name supplied")
end if

' Set variable with path to iso_launcher
strPhysPath = Request.ServerVariables("APPL_PHYSICAL_PATH") & "iso_launcher\"
objShell.CurrentDirectory = strPhysPath

' Setup command line string to execute, starts remotecontrol.exe query to see if client is powered off
strCMD = "%COMSPEC% /c remotecontrol.exe -p -user " & strUser & " -pass " & strPass & " http://" & strFQDN & ":16992/RemoteControlService >out.txt"
objShell.Run strCmd, 0, True

' Read in a stream of text from remotecontrol.exe
Set objOutFile = objFSO.GetFile("out.txt")
Set objTextStream = objOutfile.OpenAsTextStream(ForReading, TristateUseDefault)
do until objTextStream.AtEndOfStream
	strLine = objTextStream.ReadLine
	if (InStr(strLine, "SOAP failure") <> 0) then
		strMessage = strFQDN & " is unreachable.<br><br>"
		strMessage = strMessage & "The host name you entered may not be valid<br>"
		strMessage = strMessage & "or the remote client may be unable to respond.<br>"
		ErrorExit(strMessage)
	elseif (InStr(strLine, "SystemPowerstate is:") <> 0) then
		if (InStr(strLine, "0") <> 0) or (InStr(strLine, "512") <> 0) then
			strTMP = MyMessage(strFQDN & " is powered on...<br><br>",0,strDialogTitle,64 + 1)
		elseif (InStr(strLine, "1") <> 0) then
			ErrorExit(strLine)
		elseif (InStr(strLine, "2") <> 0) then
			ErrorExit(strLine)
		elseif (InStr(strLine, "3") <> 0) then
			ErrorExit(strFQDN & " is in sleep state...<br><br>")
		elseif (InStr(strLine, "4") <> 0) then
			ErrorExit(strFQDN & " is suspended...<br><br>")
		elseif (InStr(strLine, "5") <> 0) then
			strTMP = MyMessage(strFQDN & " is powered off...<br><br>",0,strDialogTitle,64 + 1)
		else
			ErrorExit(strLine)
		end if
	end if
loop
%>

</BODY>
</HTML>

<%

function MyMessage(strMessage,intTimeOut,strTitle,intButton)
		Response.Write(strTitle & "<br>")
		Response.Write(strMessage & "<br>")
		ccsleep(intTimeOut)
		MyMessage = 0
end function

function ErrorExit(strMessage)
	if strMessage <> "" then
		strTMP = MyMessage(strMessage,0,strDialogTitle & " - Error",16)
	end if
	
	' Unsuccessful end of script, exit the script
	Response.End
end function

function ccSleep(seconds)
	cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul"
	objShell.Run cmd,0,1
end function

%>

Created on Oct 20, 2010 8:36:03 PM by  johnagardner (10)

Last change on Oct 21, 2010 11:38:50 AM by  Torsten Lindner [Paessler Support] (19,480) 3 1



Votes:

0

Your Vote:

Up

Down

Guys,

These are terrific posts.

I've had great success with the small batch file but it only detects the presence of the device. I'm going to play around with some of your suggestions to see if I can start collecting better data. We have several computers labs and polling power states would be a huge plus towards our Greening IT initiative. We have tried to stay away from additional software because we like centralizing our statistic collection and we don't like adding additional software to lab images.

Thanks for the info both of you.

- Andrew

Created on Oct 21, 2010 1:11:27 PM by  Andrew Brigham (101) 1 1



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.

PRTG
Network Monitor
Intuitive to Use.
Easy to manage.

150.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Visit
www.paessler.com

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

Top Tags


View all Tags