Contact Info

ActiveXperts Network Monitor ships with a powerful set of pre-defined checks. Each individual check has a static number of configuration items. To monitor other items, or to combine monitoring items, you can make use of custom PowerShell checks.

Most of the built-in checks have a PowerShell equivalent, implemented as a PowerShell (.ps1) script file. Out-of-the-box, each PowerShell script monitors the same items as the built-in check. Feel free to modify the script.

To add a new PowerShell-based Http monitoring check, do the following:

To customize the above monitoring check, click on the 'Edit button' next to the 'Script File' selection box. Notepad will be launched. You can now make changes to the PowerShell script.

Powershell Http check

Http.ps1 script source code

#################################################################################
# ActiveXperts Network Monitor PowerShell script, (c) ActiveXperts Software B.V.
# For more information about ActiveXperts Network Monitor, visit the ActiveXperts 
# Network Monitor web site at https://www.activexperts.com
#################################################################################
# Script
#     Http.ps1
# Description:
#     Read data from a web page and search for a predefined pattern. 
#     This function uses the ActiveXperts Network Component, an ActiveXperts product.
#     ActiveXperts Network Component is automatically licensed when ActiveXperts 
#     Network Monitor is purchased
#     For more information about ActiveXperts Network Component, see: 
#       www.activexperts.com/network-component
# Parameters:
#     1) strURL - URL of the web site, without http or https prefix
#     2) strPattern - Text pattern to search for in the specified site
# Usage:
#     .\Http.ps1 '<URL>', '<Text Pattern>'
# Sample:
#     .\Http.ps1 'www.ActiveXperts.com' 'ActiveXperts'
#################################################################################

param
  (
    [string]$strURL,
    [string]$strPattern
  )

cls

# Check for parameter input
if( ([string]$strURL -eq "") -or
    ([string]$strPattern -eq "" )
  )
{
  $res = "UNCERTAIN: Invalid number of parameters - Usage: .\Http.ps1 <url> <pattern>"
  echo $res
  exit
}
  
# Create object

$objHttp = new-object -comobject ActiveXperts.Http

$objHttp.Connect($strURL)

if ( $objHttp.LastError -ne 0 )
{
 $res = "ERROR: No response received from the remote server"
 echo $res
 exit
}

$strData = $objHttp.ReadData()

if ( $objHttp.LastError -ne 0 )
{
  $res = "ERROR: No response received from the remote server"
  echo $res
  $objHttp.Disconnect()
  exit
}


if ( $strData -match $strPattern -eq "true" )
{
  echo "SUCCESS: Web site is available, text pattern found"
}
else
{
  echo "UNCERTAIN: Web site is available, text pattern not found"
}

$objHttp.Disconnect()
exit