---
title: "Custom Monitor Heroku Application"
slug: "custom-monitor-heroku-application"
updated: 2023-01-06T15:49:51Z
published: 2023-01-06T15:49:51Z
canonical: "docs.catchpoint.com/custom-monitor-heroku-application"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.catchpoint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom Monitor Heroku Application

## **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**

1. To begin the installation and configuration process, navigate to the directory below:
`$ cd /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox`
2. Install Heroku
`$ npm install -g heroku`
3. 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`
4. Install Expect
`$ yum install expect`

## **Implementation**

### Write the Custom Script
1. 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.

2. Create the first file that the Custom Monitor script will execute.
`$ vi herokuInit.sh`

3. Paste the code below and save it:
~~~
#!/bin/sh
expect /opt/3genlabs/hawk/syntheticnode/service/shellmonitor/sandbox/herokuMain.sh
~~~
4. Run these commands to change the permission and owner of the shell script:
`$ chmod 500 herokuInit.sh`
`$ chown serveruser herokuInit.sh`

5. Create the second file, which the **herokuInit.sh** script above will execute:
`$ vi herokuMain.sh`

6. 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.**

7. 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:
![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/360014690451-mceclip0.png)

You can set up Insights to capture and analyze the results.
![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/360014661932-mceclip1.png)

![](https://cdn.document360.io/cb4af8f9-6751-4fd2-b39c-07aae832badb/Images/Documentation/360014662092-mceclip2.png)
