Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

matiaskorhonen/monit-buildpack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 

Repository files navigation

Heroku Buildpack: Monit

Run Monit on Heroku.

Usage:

Create a new directory and git repository:

mkdir heroku-monit
cd heroku-monit
git init .

Initialise the Heroku app:

heroku create --buildpack=https://github.com/matiaskorhonen/monit-buildpack.git

Then create a monitrc file (see below) and push to Heroku.

Your repository structure should look like this (the conf.d directory is optional):

.
├── conf.d
│   └── example
└── monitrc

monitrc must exist and at the very minimum it should have this content:

## Start Monit in the background (run as a daemon):
set daemon  60              # check services at 1-minute intervals

## Set the location of the Monit id file which stores the unique id for the
## Monit instance. The id is generated and stored on first Monit start. By 
## default the file is placed in $HOME/.monit.id.
set idfile /app/tmp/.monit.id

## Monit has an embedded web server which can be used to view status of 
## services monitored and manage services from a web interface.
set httpd port ${PORT}
    allow ${HTTP_USER}:${HTTP_PASSWD}

check system ${SYSTEM_NAME}

## It is possible to include additional configuration parts from other files or
## directories.
#
# include /app/conf.d/*
#

You should also set the HTTP_USER and HTTP_PASSWD environment variables:

heroku config:add HTTP_USER=grimlock HTTP_PASSWD=supersecret

Environment variables in the monitrc file and in files in the conf.d directory will be substituted for the actual values as long as you use the correct format (i.e. ${MY_VARIABLE}).

The SYSTEM_NAME variable defaults to "Heroku", but you can override it if you wish:

heroku config:add SYSTEM_NAME=Grimlock

Important: Keep Monit Alive

You need to have a uptime monitor (such as Pingdom or Uptime Robot) monitoring your monit instance to make sure that it stays alive.

For this use I suggest configuring a read-only user, e.g.

set httpd port ${PORT}
    allow ${HTTP_USER}:${HTTP_PASSWD}
    allow ${READ_USER}:${READ_PASSWD} read-only

And of course set the READ_USER and READ_PASSWD variables…

For more information on how to configure Monit, see the Monit manual.

Working Example

See the heroku-monit repository for a working example: https://github.com/matiaskorhonen/heroku-monit

A slightly modified version of the heroku-monit example is publicly available at https://monit-demo.herokuapp.com/ (User: monit | Password: monit).

License

MIT License. Copyright 2012-2014 Matias Korhonen & contributors.

See the LICENSE file for more details.

Dependencies

Monit is downloaded as source code and built on Heroku and is licensed independently under the GNU Affero General Public License.

GNU gettext is downloaded as a binary and is licensed independently under the GNU General Public License

About

Run Monit, the open source monitoring utility, on Heroku.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%