New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

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

Free PRTG
Download >>

 

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


Configure sensor to monitor a date

Votes:

0

Your Vote:

Up

Down

I am looking to monitor our software maintenance contract expiration dates in PRTG. Is there a way to set up some type of sensor that would monitor a date, similar to the SSL "Days to Expiration" channel? Maybe it would read a text file of some sort? Or, if someone has some other ideas. Maybe i'm overlooking something simple. Thansk!

date monitoring prtg

Created on Jan 15, 2019 12:55:11 PM by  Kevin Joy (0) 1



4 Replies

Votes:

0

Your Vote:

Up

Down

Created on Jan 15, 2019 3:23:43 PM by  Kevin Joy (0) 1



Votes:

0

Your Vote:

Up

Down

You easily can do this with e.g. a VBscript - or PowerShell script.

E.g. this:

param(
    $AlertStartDate, #starting this date, the script will respond with an alarm state - format: yyyy-mm-dd or mm/dd/yyyy
    $StartWarningXdaysBefore #numeric, amount of days before the date to raise warning level
)

$AlertLevel = 0;
$AlertMessage = "";
$result = "";

try {
    $TimeSpan = New-TimeSpan -Start (Get-Date).ToString("yyyy-MM-dd") -End $AlertStartDate;
    if ($TimeSpan.Days -gt $StartWarningXdaysBefore) {
        $AlertMessage = "Green status - you have " + $TimeSpan.Days + " days left";
    } elseif ($TimeSpan.Days -le $StartWarningXdaysBefore -and $TimeSpan.Days -gt 0) {
        $AlertMessage = "You have " + $TimeSpan.Days + " days left";
        $AlertLevel = 1;
    } elseif ($TimeSpan.Days -le 0) {
        $AlertMessage = "Date reached or surpassed by " + $TimeSpan.Days + " days";
        $AlertLevel = 2;
    } else {
        $AlertMessage = "Unknown value in calculation";
        $AlertLevel = 4;
    }
} catch {
    $AlertMessage = "Invalid date parameter or date format issue";
    $AlertLevel = 3;
}

Function WriteXmlToScreen ([xml]$xml) #just to make it clean XML code...
{
    $StringWriter = New-Object System.IO.StringWriter;
    $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter;
    $XmlWriter.Formatting = "indented";
    $xml.WriteTo($XmlWriter);
    $XmlWriter.Flush();
    $StringWriter.Flush();
    Write-Output $StringWriter.ToString();
}
$PRTGstring="<prtg>
    <result>
	<channel>Alert Level</channel>
    <value>$AlertLevel</value>
	</result>
    <result>
	<channel>Days Left</channel>
    <value>" + $TimeSpan.Days + "</value>
	</result>

    <text>$AlertMessage</text>
    </prtg>"

WriteXmlToScreen $PRTGstring

It's and advanced EXE sensor script - you can set the date as a parameter...

Regards

Florian Rossmark

www.it-admins.com

Created on Jan 15, 2019 3:52:34 PM by  Florian Rossmark (4,285) 4 2



Votes:

0

Your Vote:

Up

Down

Hi there,

Thanks for your contribution Florian! :)

Best regards.

Created on Jan 15, 2019 3:55:27 PM by  Dariusz Gorka [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Here is one more.

DaysUntil Number of days until the given end date.


Sensors | Multi Channel Sensors | Tools | Notifications

Kind regards,

[[http://prtgtoolsfamily.com]] PRTGToolsFamily

Created on Jan 18, 2019 3:11:55 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,153) 3 4



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.