This blog post originally published at QAInsights Blog.
I run Pi-hole at home network to block ads at DNS level. I want to get notifications for specific events happened e.g. if someone launches my Pi-hole dashboard when Pi-hole is running. To overcome this issue, I integrated my Pi-hole with SolarWinds Papertrail and Pushover to get alerts. Similar approach I used to integrate with Apache JMeter with Papertrail and Pushover to get mobile notifications if my test started or stopped. In this blog post we will see Apache JMeter, Papertrail and Pushover Integration for Push Notification Alerts.
Below is the sample alert I receive in my iPhone if someone launches my Pi-hole dashboard link.
- Papertrail Setup
- Pushover app
- Apache JMeter
What is Papertrail?
Papertrail is a log management service from SolarWinds. It collects, aggregates, and manage your logs real time.
Papertrail has a free tier where you can search for 48 hours log with 7 days archive. Bandwidth is 50 MB per month free, first month you will get 16 GB as a bonus.
What is Pushover?
Pushover is a service to receive instant push notifications on your phone or tablet from a variety of sources.
Pushover offers 7 day free trial. One-time purchase unlocks unlimited usage for $4.99.
Assume that you are running a JMeter test and would like to receive a mobile notification if somethings happens to your test such as thread stopped, exceptions thrown etc. Integrating JMeter with Papertrail and Pushover is the one of the easiest setup you would need. Also, this is very affordable approach too.
Other than mobile notifications, you could set up SMTP sampler under Once-Only Controller in your test plan.
Another Use Case
If you are running your JMeter test plan from CI/CD tool. If you would like to know when your test gonna start and end, you can make this integration happen and get notified instantly in your mobile devices.
There might be other ways to securely send notifications. If you don't mind in sharing your logs your Papertrail, this approach is quite easy.
You can read about Papertrail trust factor.
system/OS logs and your OS as shown below. Then follow the steps: Download nxlog, Configure the
conf file, and activate the service.
Before you activate, you need to configure the
conf with your JMeter log file location. Locate the
<Input watchfile>tag and make sure you are mapping the JMeter log location as shown below.
# Monitor application log files <Input watchfile> Module im_file File 'C:\\Users\\Documents\\Apache-JMeter\\apache-jmeter-5.2.1\\bin\\*.log' Exec $Message = $raw_event; Exec if file_name() =~ /.*\\(.*)/ $SourceName = $1; SavePos TRUE Recursive TRUE </Input>
To start the service, you must launch the command prompt with administrator privilege.
If you want to configure multiple log files, you need to just copy and paste the watchfile tag.
nxlog service is activated, your system will stream the log info to your Papertrail account.
Go to Dashboard page to see your system. Click on the system link, which will take you to Events page.
Events page will be blank as shown below. That is because, we are not running any JMeter tests.
Now let us run a sample JMeter test which will generate logs and it will get streamed to the Papertrail dashboard as shown below.
To set up alerts we will need to configure Pushover. Download the Pushover app, it supports iOS, Android, and Browsers).
Create an account for free and try for 7 days. If you like the features, you could purchase the license for $4.99.
You need to do the following:
- Add your device
- Create an Application or API Token
You can test your push notification in Pushover app. You can also create email aliases if you would like to set up email notifications.
Configure Alerts in Papertrail
Test Start Alerts
If you would like to receive push notification once the test is started, go to Events and search for "Thread Started" and hit enter.
Click on Save Search button and enter a name and then click on Save and Create Alert. This will save the entered search term and take you to Alert page configuration.
Papertrail supports multiple platforms. To configure Pushover, click on the Pushover link as shown below.
In this page, you need to configure the alert conditions and Pushover details. You can customize the timestamp, frequency etc. After configuring, click on Create Alert button.
You can see all the alerts in the https://papertrailapp.com/alerts page. Similarly you can set up the alert once the test is ended. You will receive the notifications as shown below.