JMeter, Papertrail and Pushover Integration for Push Notification Alerts
Tags: jmeter, pushover, papertrail, testing
Published: 2020-03-09 15:32:00

This blog post originally published at [QAInsights Blog.](https://qainsights.com/jmeter-papertrail-and-pushover-integration-for-push-notification-alerts/)

<!-- wp:paragraph -->
<p>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 <a href="https://papertrailapp.com/?thank=cb27c5">SolarWinds Papertrail</a> and <a href="https://pushover.net/">Pushover</a> 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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Below is the sample alert I receive in my iPhone if someone launches my Pi-hole dashboard link.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":6999,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-26.png" alt="Pi-hole Pushover Integration" class="wp-image-6999"/><figcaption>Pi-hole Pushover Integration</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Prerequisites </h2>
<!-- /wp:heading -->

<!-- wp:list {"ordered":true} -->
<ol><li>Papertrail Setup</li><li>Pushover app</li><li>Apache JMeter</li></ol>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>What is Papertrail?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><a href="https://papertrailapp.com/?thank=cb27c5">Papertrail</a> is a log management service from SolarWinds. It collects, aggregates, and manage your logs real time. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center"><a href="https://papertrailapp.com/?thank=cb27c5">Sign up for free Papertrail account</a></p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>What is Pushover?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p> Pushover is a service to receive instant push notifications on your phone or tablet from a variety of sources.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Pushover offers 7 day free trial. One-time purchase unlocks unlimited usage for $4.99.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Use Case</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Other than mobile notifications, you could set up SMTP sampler under Once-Only Controller in your test plan. </p>
<!-- /wp:paragraph -->
<!-- wp:heading -->
<h2>Another Use Case</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>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.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You can read about <a href="https://help.papertrailapp.com/kb/how-it-works/why-should-i-trust-you/">Papertrail trust factor</a>.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Configuring Papertrail</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>First, create an account with <a href="https://papertrailapp.com/?thank=cb27c5">Papertrail</a>. Head to <a href="https://papertrailapp.com/start">start page here</a> and add your system where you run JMeter test plan.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Select <code>system/OS logs</code> and your OS as shown below. Then follow the steps: Download nxlog, Configure the <code>conf</code> file, and activate the service.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7000,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-27.png" alt="Download nxlog" class="wp-image-7000"/><figcaption>Download nxlog</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Before you activate, you need to configure the <code>conf</code> with your JMeter log file location. Locate the <code>&lt;Input watchfile&gt;</code>tag and make sure you are mapping the JMeter log location as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code># Monitor application log files
&lt;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
&lt;/Input></code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>To start the service, you must launch the command prompt with administrator privilege. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>If you want to configure multiple log files, you need to just copy and paste the watchfile tag.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Once the <code>nxlog</code> service is activated, your system will stream the log info to your Papertrail account.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Go to <strong>Dashboard </strong>page to see your system. Click on the system link, which will take you to <strong>Events </strong>page.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7001,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-28.png" alt="Papertrail Dashboard" class="wp-image-7001"/><figcaption>Papertrail Dashboard</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Events page will be blank as shown below. That is because, we are not running any JMeter tests. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":7002,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-29-1024x748.png" alt="Papertrail Events" class="wp-image-7002"/><figcaption>Papertrail Events</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Now let us run a sample JMeter test which will generate logs and it will get streamed to the Papertrail dashboard as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":7003,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-30-1024x559.png" alt="Streaming JMeter logs to Papertrail" class="wp-image-7003"/><figcaption>Streaming JMeter logs to Papertrail</figcaption></figure>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Configure Pushover</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>To set up alerts we will need to configure Pushover. Download the <a href="https://pushover.net/clients">Pushover app</a>, it supports iOS, Android, and Browsers). </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Create an account for free and try for 7 days. If you like the features, you could purchase the license for $4.99. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You need to do the following:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><li>Add your device</li><li>Create an Application or API Token</li></ol>
<!-- /wp:list -->

<!-- wp:image {"id":7005,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-31-1024x865.png" alt="Configure Pushover" class="wp-image-7005"/><figcaption>Configure Pushover</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>You can test your push notification in Pushover app. You can also create email aliases if you would like to set up email notifications.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Configure Alerts in Papertrail</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3>Test Start Alerts</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>If you would like to receive push notification once the test is started, go to <strong>Events</strong> and search for "Thread Started" and hit enter. </p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7007,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-32-1024x262.png" alt="Papertrail Search " class="wp-image-7007"/><figcaption>Papertrail Search </figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Click on <strong>Save Search </strong>button and enter a name and then click on <strong>Save and Create Alert</strong>. This will save the entered search term and take you to Alert page configuration.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7008,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-33.png" alt="Create Search and Alert" class="wp-image-7008"/><figcaption>Create Search and Alert</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>Papertrail supports multiple platforms. To configure Pushover, click on the Pushover link as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7009,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-34.png" alt="Create an Alert" class="wp-image-7009"/><figcaption>Create an Alert</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>In this page, you need to configure the alert conditions and Pushover details. You can customize the timestamp, frequency etc. After configuring, click on <strong>Create Alert </strong>button.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":7014,"sizeSlug":"large"} -->
<figure class="wp-block-image size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-37.png" alt="Alert Configuration in Pushover" class="wp-image-7014"/><figcaption>Alert Configuration in Pushover</figcaption></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>You can see all the alerts in the <a href="https://papertrailapp.com/alerts">https://papertrailapp.com/alerts </a>page. Similarly you can set up the alert once the test is ended. You will receive the notifications as shown below.</p>
<!-- /wp:paragraph -->

<!-- wp:image {"align":"center","id":7011,"sizeSlug":"large"} -->
<div class="wp-block-image"><figure class="aligncenter size-large"><img src="https://qainsights.com/wp-content/uploads/2020/03/image-36.png" alt="JMeter, Papertrail and Pushover Integration for Push Notification Alerts" class="wp-image-7011"/><figcaption>JMeter, Papertrail and Pushover Integration for Push Notification Alerts</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>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. </p>
<!-- /wp:paragraph -->