Integrating Scripts into Longitude

February 26, 2020 | Ken Leoni

Longitude is all about delivering a great experience for IT staff and management, enabling them to quickly and easily monitor a broad set of IT Infrastructure and Application components by leveraging an extensive out of the box knowledge base.

Modern notebook computer with future technology media symbols
However, there are often instances where IT organizations want to customize Longitude to monitor for problems that are quite unique to their environment. This is easily accomplished via Longitude Transactions.


Longitude Transactions test for problems. When a test fails, a Critical severity Longitude event is generated, which is escalated if the problem continuously occurs. When the problem has been resolved, Longitude generates a Cleared severity event.

Longitude Events are in and of themselves actionable and actions include email, paging, corrective actions, and web hooks (i.e. triggering events on services such as Slack).


Longitude Transaction List
DNS The DNS protocol enables you to test whether a DNS server can resolve the IP address of a fully qualified host name.
FileContent The FileContent transaction enables you to check a file for undesired content, such as an error message recorded in a log file.
FileExistence The FileExistence transaction enables you to monitor for the existence or absence of a file.
FTP The FTP protocol enables you to test whether a user can connect to an FTP server.
HTTP (HTTPConnect, HTTPUrl) The HTTP protocol enables you to test whether Longitude can connect to an HTTP site, and whether the text on a web page matches the expected content.
NNTP The NNTP protocol enables you to test whether an NNTP server is accessible.
Ping (Ping, PingCritical) The Ping protocol enables you to test for a reply from a ping – different tests are available for different levels of criticality.
Port The Port protocol enables you to test whether a connection can be made to a port.
Process (UnixProcess, WinProcess) The Process protocol enables you to test whether a particular process exists, with different tests tailored for Unix/Linux and Windows processes.
Script (UnixScript, WinScript) The UnixScript and WinScript transactions enable you to monitor the output of a script.
Service The Service protocol enables you to test whether a particular service is running.
SMTP The SMTP protocol enables you to test whether a connection can be made to an SMTP serve
SQL (SQLConnect, SQLQuery) The SQL protocol enables you to test whether a connection can be made to a SQL server, and to monitor the output of a query.
SSH / UnixConnect The SSH protocol enables you to test whether an SSH connection can be made to a server; on Unix/Linux, the test can be made for SSH or Rexec, and the connection can be made using public-key authentication, if desired.
Telnet The Telnet protocol enables you to test whether a Telnet connection can be made to a server
WinShare The WinShare transaction enables you to test whether a Windows share exist
WmiConnect The WmiConnect protocol enables you to test whether Longitude can connect to WMI on a computer

Start Your Free 14 Day Trial of  Longitude Today!

Integrating External Scripts

As we can see there are quite a few tests available and one of the more powerful transaction types are the Script transactions (UnixScript, WinScript), 

Longitude supports external scripting using whatever language you prefer. The fundamental principle is to leverage external scripting to execute any program, evaluate the output, and generate an event when a problem is detected.


Step 1 - Generate a Script

The general rule of thumb is that if you can run your script from the command line, then you can integrate it into Longitude.   For example, the following VBScript will look for how long it has been since a given file has been modified.


Dim objFSO, FileName, objFile

Set objFSO = CreateObject("Scripting.FileSystemObject")

FileName = WScript.Arguments(0)

If objFSO.FileExists(FileName) Then

    set objFile = objFSO.GetFile(FileName)

    Wscript.stdout.write DateDiff("n",objFile.DateLastModified,Now)



End If

To execute this script from a command prompt, we use the "cscript" command and provide a UNC path to the file being evaluated.  The script will return the number of minutes since the specified file was last modified or a "-1" if the file is not found. 

Longitude Script Output2

The example above shows that the WindowsUpdate.log on server was last modified an hour ago.

Note that we’ve placed the script in the Longitude root directory, in this instance C:\Program Files\Longitude.  The scripts can reside anywhere accessible to the Longitude console, but for now we'll stick to the default root location.

Step 2 – Configure Longitude to Monitor using the script

Once you have created the script, monitoring with Longitude is simple.

You open the Monitor an Application window, and select Monitor from the Monitor button in the upper right of the Web UI, or from the right-click menu for Enterprise at the top of the devices tree. 

One thing to remember when defining the transaction is that you want to define a condition for when the transaction is successful.  For example, if you want to make sure that the file is updated at least every 24 hours, and this script returns the last modification time in minutes, then the script is returning a good condition when the number of minutes is <= 1440.  Longitude will create an event to tell you when this condition is not satisfied.

    • Application - Select Transaction and Windows Script 
    • Computers - Enter the computer that you’d like to identify with the problem
    • Instance - Enter a friendly description of the problem that will be used as part of notification
    • Command - The OS command we tested in the previous step. Note that Longitude will default to running and testing the script every 5 minutes. 
    • Comparison Operator - <=
    • ComparisonValue - 1440

Monitor an Application with Longitude


Longitude Monitoring


Step 3 – Configure Longitude Events

When Longitude detects a problem it creates an Event, and that event can trigger an Action or set of Actions. Actions can be used to execute OS commands, or to send alert messages via Email, Text Message, and web hooks.

    • Click on Events in the grey menu bar.
    • Click on the Actions tab.
    • A new action can be created by clicking on the New Action button in the right-hand corner seen in the screenshot below.

Configuring Events and Actions Longitude


Longitude Events


IT staff can readily leverage scripting to quickly create custom monitoring solutions that address problem areas that are unique to their environment.

Almost any script can be integrated into Longitude, extending the technology to address many situations.

The scripts and actions referenced in this blog are configured and available for review on Longitude’s Live Online Demo.

Try Longitude Live Online Demo!

Access our online demo environment, see how to set up IT monitoring, view dashboards, problem events, reports and alerts. Please log in using the credentials below:

  • Username:   demo
  • Password:    longitude
We value your privacy and will not display or share your email address

Sign Up for the Blog

Heroix will never sell or redistribute your email address.