Monit Graph
Monit Graph is a logging and graphing tool for Monit written in PHP5. It can manage big amounts of data, and will keep a history of Monit statuses.
Features
- Easy to manage and customize
- Several different graphs (Google Charts) of memory, cpu, swap and alert activity
- Data logging with XML files
- Chunk rotation and size limitation
- Multiple server setup
Get started
To get started, you will first need to have Monit installed with HTTP access enabled. You can read more under "Setting up Monit".
composer install
- Add
config/servers.ini
(you can useservers.template.ini
) - Set up a crontab job to run cron every minute:
* * * * * cd /path/to/monit-graph && php src/scripts/cron.php >> /var/log/monit-graph.log
- Start server:
composer server
Setting up Monit
To setup Monit on Ubuntu, please follow the below steps.
Install Monit
sudo apt-get update
sudo apt-get install monit
Edit configuration file for Monit
sudo vi /etc/monit/monitrc
Make sure the following parameters are set correctly (these are examples, adjust accordingly):
set idfile /var/run/monit-id
set statefile /var/run/monit-state
set daemon 60
set logfile /var/log/monit.log
set mailserver localhost
set mail-format { from: monit@mydomain.com }
set alert myemail@myemaildomain.com # receive all alerts
set httpd port 2812 and use the address XX.XX.XX.XX # Remove "and use the address XX.XX.XX.XX", if not bind to specific IP
ssl enable # Enabling SSL
pemfile /etc/ssl/monit.pem # The PEM file
signature disable # No server signature to send
allow mylogin:"mypassword" # Login
Remember to allow httpd to run, or else Monit graph cannot contact you.
Add services to Monit
Add a few configuration files into the /etc/monit/conf.d/ directory. You can use the examples from the monitrc directory.
Check if the configuration are good:
monit -t
Restart Monit with the new configuration
Restart
service monit restart
Tips
-
If the script have trouble managing big amounts of data, try increase the allowed allocated memory in a .htaccess
-
REMEMBER to password protect the directory with .htaccess or anything appropriate
-
Loading many services can be very heavy for your browser, try specify the services you wish be shown.
Contributing
Monit-Graph has a few tools to help development.
Build massive data structure
composer build-massive-data
Links
Blog post about Monit and Monit-Graph
About
Dan Schultzer works at Dream Conception (http://dreamconception.com/). This script was developed to increase the usability of Monit.