DEV Community

NaveenKumar Namachivayam ⚡
NaveenKumar Namachivayam ⚡

Posted on

JMeter, Papertrail and Pushover Integration for Push Notification Alerts

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.

Pi-hole Pushover Integration
Pi-hole Pushover Integration

Prerequisites

  1. Papertrail Setup
  2. Pushover app
  3. 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.

Sign up for free Papertrail account

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.

Use Case

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.

Configuring Papertrail

First, create an account with Papertrail. Head to start page here and add your system where you run JMeter test plan.

Select system/OS logs and your OS as shown below. Then follow the steps: Download nxlog, Configure the conf file, and activate the service.

Download nxlog
Download nxlog

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.

Once the 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.

Papertrail Dashboard
Papertrail Dashboard

Events page will be blank as shown below. That is because, we are not running any JMeter tests.

Papertrail Events
Papertrail Events

Now let us run a sample JMeter test which will generate logs and it will get streamed to the Papertrail dashboard as shown below.

Streaming JMeter logs to Papertrail
Streaming JMeter logs to Papertrail

Configure Pushover

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:

  1. Add your device
  2. Create an Application or API Token

Configure Pushover
Configure Pushover

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.

Papertrail Search
Papertrail Search

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.

Create Search and Alert
Create Search and Alert

Papertrail supports multiple platforms. To configure Pushover, click on the Pushover link as shown below.

Create an Alert
Create an Alert

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.

Alert Configuration in Pushover
Alert Configuration in Pushover

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.

JMeter, Papertrail and Pushover Integration for Push Notification Alerts
JMeter, Papertrail and Pushover Integration for Push Notification Alerts

Conclusion

Integrating JMeter with Papertrail and Pushover is the one of the affordable and easiest way to get alerts for your JMeter test plan. If you care about privacy and do not want to share the logs with Papertrail, then you need to read Papertrail privacy policy before you start the Papertrail service.

Top comments (0)