Introduction
Heroku is a cloud platform as a service (PaaS) that supports multiple languages, including Java, Node.js, Scala, Clojure, Python, PHP, and Go. Heroku provides a hosting space, accessible to its users, where applications reside. When you deploy an application on Heroku, you can access it over a command line tool. This allows you to log in to your Heroku account and fetch necessary information.
This guide will cover installing Heroku and Expect on your node, so you can monitor your Heroku application using the Catchpoint Custom Monitor.
Prerequisites
- An application deployed to Heroku.
- Commands to fetch the wanted details of your Heroku application.
Installation & Configuration
- To begin the installation and configuration process, navigate to the directory below:
$ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox - Install Heroku
$ npm install -g heroku - After you install Heroku, run this command to check if it’s installed correctly. This command should display the Heroku version installed on your node.
$ heroku -v - Install Expect
$ yum install expect
Implementation
Write the Custom Script
-
Navigate to /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox to create a shell script.
In our demonstration, we will rely on an Expect script to initiate the shell script execution. To achieve this, we will need two shell scripts. Catchpoint Custom Monitor will execute the first script, which in turn will execute the second script with Expect command to get the details from the Heroku application. -
Create the first file that the Custom Monitor script will execute.
$ vi herokuInit.sh -
Paste the code below and save it:
#!/bin/sh
expect /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox/herokuMain.sh
-
Run these commands to change the permission and owner of the shell script:
$ chmod 500 herokuInit.sh
$ chown serveruser herokuInit.sh -
Create the second file, which the herokuInit.sh script above will execute:
$ vi herokuMain.sh -
Paste the code below and save it:
#!/bin/sh
spawn heroku "login"
expect "Email*"
send "Username_here"
send "\r"
expect "P*"
send "Password_here"
expect "P*"
send "\r"
expect "Logged in as*"
sleep 2
spawn heroku <command here>
interact
Note: Update the username, password, and Heroku command in the above script.
- Run these commands to change the permission and owner of the shell script:
$ chmod 500 herokuMain.sh
$ chown serveruser herokuMain.sh
Create the Custom Test
Create a Custom Test within the Portal with the JSON template below. Make sure that you replace the filename with the one you chose.
{
"shell_command_file_name":" herokuInit.sh"
}
Results
Based on the output that gets printed in the console, you can create Tracepoints and Indicators to capture the metrics and analyze them in the Portal.
Here are the results of the test:

You can set up Insights to capture and analyze the results.

