In past articles, I discussed and overview of the PRTG Network Monitor along with some info on creating your own sensors to customize your monitoring experience. In this article, I’m going to dig into alerting and notifications.
PRTG’s Flexible Alerting
No monitoring system would be useful without a system to alert the users when something goes wrong. Like it’s sensor subsystem, PRTG is very flexible in the configuration of alert notifications and even goes so far as to allow you to create your own alert notification scripts if you want to do something beyond their built-in support for Email, SMS/Pager, syslog, SNMP Traps, HTTP requests, Event log entries, alarm sound files and Amazon SNS.
The way alerts work is that you can create custom “State Triggers” on the objects you create. The triggers can be inherited in your object hierarchy to make it easier to share configuration across all of your objects. State triggers can be configured based on:
Status - an objects status is up, down, or warning
Limit - an object’s value goes above or below a specified value.
Threshold - an object’s value goes above or below a specified value for a set number of minutes
Multiple Condition - objects x and y having certain state conditions
Escalations - Extra notifications every “x” minutes during downtime
Dependencies - This will help avoid false alarms.
Alert Scheduling - set a time window when certain priority events will not be sent.
Above is a setting we have for one of our external VIPs for DevCentral. We have it setup so that if any of the child sensors are marked “down” for 60 seconds, the “DCOps Notification (Email + SMS)” notification event is performed.
The notifications are configured by clicking on the “Setup” menu and then picking the “Notifications” menu under the “Account Settings”.
At that point you can configure the default monitors. Email has it’s own section and all you have to do is specify an email address, subject, and the message body. We just relied on the default templates provided by PRTG which worked great.
Email is great, but things get lost in there and we wanted a way to send a second type of notification to our Operations team to make sure they got it and no better way than sending a text directly to their phones.
Configuring SMS wasn’t quite as easy as email. The built-in SMS options rely on 3rd party services that charge a fee for their services. I’ve been writing scripts for a long time that have sent texts to my phone so I thought there had to be a way to adapt that into this system - and of course there was!
PRTG allows for you to write your own custom programs that the notifications will run when a notification needs to occur. This is configured in the “Execute Program” section of the Notification configuration as shown below.
Custom Notification - Notify-SMS.ps1
Since I’ve already written the SMS code in PowerShell, it was a no brainer to whip up a script
In the configuration I’ve included the PRTG parameters for the Device, Name, Status, Down state, Date and Time, and the Status message in the parameters to the script.
The big question you are probably asking is how it’s sending an SMS message. Well, Verizon and AT&T, which our team has our cell phones on, have a SMS gateway through email. By sending an email to your cellphone number to the providers gateway, it will get sent to their phones as a text message! Verizon uses “vtext.com” and AT&T uses “txt.att.net”;
In the script I define the dev-ops team that will receive the notifications and it then calls the PowerShell Send-MailMessage Cmdlet to send it off to our phones. This was a lot easier that using a costly SMS gateway.