Submit a ticketCall us

Training ClassThe Orion® Platform Instructor-led Classes

Provided by SolarWinds® Academy, these trainings will introduce users to the Orion Platform and its features, management, and navigation. These courses are suitable for users looking to discover new tips, tricks, and ways to adapt their Orion products to better suit their monitoring needs:
Deploying the Orion Platform
Configuring Orion views, maps, and accounts
Configuring Orion alerts and reports

Reserve your seat.

Home > Success Center > Server & Application Monitor (SAM) > SAM - Knowledgebase Articles > Apache (Windows) application monitor does not work with port 443 in SAM

Apache (Windows) application monitor does not work with port 443 in SAM

Updated January 22, 2019

Overview

As described in the SAM Template Reference, the Apache (Windows) template uses a PowerShell script to retrieve server statistics from the built-in Apache server-status web pagel script.

Application monitors created using this template that use port 443 instead of the default port, 80, may receive a certificate error that the script cannot bypass. If that occurs, you can add lines to the script to bypass the certificate check, as provided in this article.

Environment

  • SAM 6.0 and later

Cause

The PowerShell script used by Apache (Windows) application monitors cannot bypass certificate errors that occur if port 443 is used in the following script argument:

server,server_port where

  • server is the hostname or IP address of the target Apache server. You should set this argument to ${IP} which automatically replaces this argument with the target host IP address.
  • server_port is the Apache port under which the site is running. By default, the port is set to 80.

Resolution

  • Use the default port in the Apache (Windows) template, 80
  • Add the following lines to the PowerShell script in Apache (Windows) application monitors:
    • [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;

    • [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }

Here is an example of the entire script:

function Check_Dot {
param($stat);
$ret=$stat;
if ($stat[0] -eq '.') { $ret="0"+"$stat"; }
return $ret;
}
$Error.Clear();
$server = $args.get(0);
$port = $args.get(1);
if ( $port -eq $null ) { Write-Host "Message: Can't find ""port"" argument. Check documentation."; exit 1; }
if ( $server -eq $null ) { Write-Host "Message: Can't find ""server"" argument. Check documentation."; exit 1; }
$url="https://"

$server":"$port"/server-status?auto";
try {
$web = new-object net.webclient;
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }

$str = $web.DownloadString($url);
}
catch {
Write-Host "$($Error[0])";
exit 1;
}
$result = ($str -split '[\r\n]') |? {$_}
$result | foreach-object {
if ($_ -match "Uptime:")

{ $tmp = $_.split(":"); $stat = Check_Dot $tmp[1]; }

}
$ts = New-TimeSpan -Seconds $stat;
$ts_d = [string] $ts.Days;
$ts_h = [string] $ts.Hours;
$ts_m = [string] $ts.Minutes;
$ts_s = [string] $ts.Seconds;
$ftime = "$ts_d"

"d ""$ts_h""h ""$ts_m""m ""$ts_s"+"s";
write-host "Statistic: $stat";
write-host "Message: Server uptime: $ftime";
exit 0;
Last modified

Tags

Classifications

Public