Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
autoIT in Nagios XI
The Industry
Standard in IT Infrastructure Monitoring
Purpose
This document describes how to time program start times in Windows with autoIT.
Target Audience
This document is intended for use by Nagios XI Administrators who want to monitor how long Windows takes to fully start a program or
application. A basic knowledge of autoIT is recommended.
Prerequisites
It is required that you have AutoIT installed, as well as it's script editor. A guide this can be found at:
http://assets.nagios.com/downloads/nagiosxi/docs/Integrating_autoIT_With_Nagios.pdf
You must also have NSClient++ installed on the Windows machine you intend to use for this task. Information on NSClient++ can be
found at:
http://www.nsclient.org/nscp/wiki/Documentation
This script bahaves much like the autoIT timer script, as can be seen
a timer funtion is initiated and Mozilla Firefox's executable is ran. After
the program loads the timer is stopped and the time is saved to a text
document named ProgramLoadingTime.txt. The time is then printed by
a shell script to the Nagios server's command line.
Defining A Check
The next step is to create a batch file and define an NSClient++ check that can be used by Nagios to launch the autoIT script you
Web: www.nagios.com
Email: sales@nagios.com
Page 1
Copyright 2010-2011 Nagios Enterprises, LLC
Revision 1.0 June, 2012
create.
You can do this by opening your favorite text editor and pasting in the batch script below, which can be found at
http://www.pastebin.com/54kKBSwb.
@echo off
cd C:\Users\Administrator\Desktop
programloadtime.au3
type ProgramLoadingTime.txt
@exit 0
Once the script is pasted into notepad save the file as a batch file (.bat)
named check_programloadingtime.bat to the directory where your
NSClient++ scripts are located.
The check must now be added to the nsclient.ini file, or NSC.ini depending on which version of NSClient++ the windows host is
operating under. Open the .ini which will be located in the base NSClient++ directoy and find the external scripts section. Here below
the other defined checks add this string:
check_plt =scripts\check_programloadingtime.bat $ARG1$
Note: Be sure to use the directory where your checks are located if you
have altered it from the default.
After nsclient.ini/NSC.ini has been edited restart NSClient++ in windows
cmd with the commands:
net stop nscp
net start nscp
OR if you are using an older version of NSClient++
net stop nsclientpp
net start nsclientpp
You can now test the check which has been added, enter
nscp test
into the Windows command line, in order to locally check your new batch file and see if it prints out the time in milliceconds it took to
load the program use the following
command:
check_plt
As you can see 1094.23076117216 was the load time of the program saved as text and printed back to us. Don't worry! The plugin that
has been written turns this is to a much more manageable format.
Web: www.nagios.com
Email: sales@nagios.com
Page 2
Copyright 2010-2011 Nagios Enterprises, LLC
Revision 1.0 June, 2012
check_autoit_timer
In the Command Line box enter the following:
check command
Web: www.nagios.com
Email: sales@nagios.com
Page 3
Copyright 2010-2011 Nagios Enterprises, LLC
Revision 1.0 June, 2012
check_autoit_timer
Under Hosts we will select our windows machine which we will be running the command on.
The Service Description:
check_autoit_timer
Now the arguments which corresponds with the plugin check
must be added.
$ARG1$ = check_plt
$ARG2$ = Warning Threshold
;The amount
(In milliseconds that the check will
create a warning from)
$ARG3$ = Critical Threshold ;The amount
of time required to trigger the critical
threshold, once again in milliseconds
And finally the template we will choose will be:
generic-service
Web: www.nagios.com
Email: sales@nagios.com
Page 4
Copyright 2010-2011 Nagios Enterprises, LLC
Revision 1.0 June, 2012
Web: www.nagios.com
Email: sales@nagios.com
Page 5
Copyright 2010-2011 Nagios Enterprises, LLC
Revision 1.0 June, 2012