FeaturesWP CloudPricingEE CLIContactMy Account
Features
Team Access & User Permissions
Install
Resources
Community
CLEAR
Tutorials
Monitoring
Latest Monit setup on Ubuntu
Topics
On this page
-
- Getting Started
- Git and File-System Layout (non-default setup)
- Version Constraints
- Managing Themes and Plugins (for entire WordPress site)
- Updating Themes and Plugins (for entire WordPress site)
- Adding Composer Support to Your Own Themes and Plugins (for developers)
- Using Composer to Manage Own Theme/Plugin Dependencies (for developers)
-
- Assigning Multiple IP Addresses to Single LAN Card
- Disable IPv6 on Ubuntu 12.04
- dsh – distributed shell
- fdupes – find & replace duplicate files with hardlinks
- GPG Keys Cheatsheet
- Increase "Open Files Limit"
- kill all php, nginx, mysql or any kind of processes
- Passwordless Authentication for SSH
- Screen
- search replace in multiple files useing grep xargs sed
- Setup sftp
- sysctl.conf
- Timezone Sync
- Using Google Public DNS on Ubuntu Server
- Using openssl to match private key, cerificate and CSR
- Configure Postfix to Use Gmail SMTP on Ubuntu
- Logrotate Example for Custom Logs
- PHP 5.5, MySQL, Postfix, Nginx and WordPress on Ubuntu
- Serverdensity
- Upgrade Ubuntu 10.04 to 12.04
- Using find and sed to replace strings in multiple files
- Webmin
-
- .my.cnf – mysql user & password
- Analyse slow-query-log using Anemometer
- Improving MySQL Query Cache
- MySQL Query Profiling
- Reset MySQL root password
- tuning-primer.sh – an alternative for mysqltuner
- Using MariaDB 10
- Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
- Change WordPress Domain Name
- Character Sets and Collations
- Enable innodb_file_per_table
- Enable Remote Access (Grant)
- Installing Percona Toolkit
- Using tmpfs for temporary folder creation
- YARPP and InnoDB
- Convert MyISAM to InnoDB
- Using tmpfs for mysqldump & mysqlimport
- Convert from INNODB to MYISAM
- Analyse slow-query-log using mysqldumpslow & pt-query-digest
- mysqlcheck with cron to optimize automatically
- Using MySQLTuner to Optimize MySQL configuration
-
-
- Directly connect to PHP-FPM
- Generating core-dump for php5-fpm
- GeoIP
- Having php5 and php7 on same system.
- Install Xdebug and configure it with webgrind
- Installation of PHP Code Review Tools
- memcache
- PHP's Zend Opcache Config & Web Viewer
- Setting Sqlite support with PHP
- Using HHVM with PHP-FPM Fallback
- Using Redis for PHP Sessions on Ubuntu Server
- Installing PhpMyAdmin Quickly
- Moving PHP's session storage to tmpfs
- Install Xdebug and configure it with Netbeans
- Nginx – Enable PHP-FPM Status Page
- PHP-FPM: Socket vs TCP/IP and sysctl tweaking
- APC Cache Optimization & Monitoring Using Web Interface
- Checking if PHP/WordPress can send mails
- Debugging PHP Scripts Using slow_log and more
- Increase file upload size limit in PHP-Nginx
- Increase PHP script execution time with Nginx
-
- Performance Optimization
- Remove Query string of css/js files
- Setup ElasticSearch with ElasticPress
- Using Redis for WordPress Object-Cache
- WooCommerce Window Shopping Caching Technique
- Moving WordPress To New Server (Faster)
- Better wp-cron using linux's crontab
- 404 error- Page not Found!!!
- Debugging WordPress with Nginx
Install
apt-based
Binary Install
Monit Config File
Verify
Monit-Graph
Install monit-graph
Config File
Setup Cron
View Graphs
TODO
Latest Monit setup on Ubuntu
Install
apt-based
apt-get install monit
Following installs Monit 5.3 on Ubuntu 12.04. Which is very old!
Binary Install
Go to http://mmonit.com/monit/#download and pick correct binary for your system. Following lines will install Monit 5.14 for Ubuntu 64-bit.
cd ~
wget http://mmonit.com/monit/dist/binary/5.14/monit-5.14-linux-x64.tar.gz
tar zxvf monit-5.14-linux-x64.tar.gz
cd monit-5.14/
cp bin/monit /usr/bin/monit
mkdir /etc/monit
touch /etc/monit/monitrc
chmod 0700 /etc/monit/monitrc
ln -s /etc/monit/monitrc /etc/monitrc
wget https://gist.githubusercontent.com/rahul286/9975061/raw/1aa107e62ecaaa2dacfdb61a12f13efb6f15005b/monit -P /etc/init.d/
chmod u+x /etc/init.d/monit
echo "START=yes" > /etc/default/monit
monit -t
Config
Monit Config File
Add/Update following in /etc/monit/monitrc
#Monitoring Interval in Seconds
set daemon 60
#Enable Web Access
set httpd port 2812
allow admin:easyengine
#Event Queue for 5000 events
set eventqueue basedir /var/monit slots 5000
#MySQL Monitoring
check process mysqld with pidfile "/var/run/mysqld/mysqld.pid"
if cpu > 80% for 2 cycles then alert
#PHP-FPM
check process php5-fpm with pidfile "/var/run/php5-fpm.pid"
if cpu > 80% for 2 cycles then alert
#Nginx
check process nginx with pidfile "/var/run/nginx.pid"
if cpu > 80% for 2 cycles then alert
#System Monitoring
check system PUT_YOUR_HOSTNAME_HERE
if memory usage > 80% for 2 cycles then alert
if cpu usage (user) > 70% for 2 cycles then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
if loadavg (1min) > 6 for 2 cycles then alert
if loadavg (5min) > 4 for 2 cycles then alert
if swap usage > 5% then alert
check filesystem rootfs with path /
if space usage > 80% then alert
set mailserver localhost
set alert you@example.com
##mmonit (optional)
#set mmonit http://user:pass@IP:port/collector
You may also wish to change username adminand password easyengine. Also, change numbers 6 and 4 in loadavg lines based on number of CPU cores on your system.
Start
First test your config using monit -t command. Then start monit using service monit start
Verify
Run command monit status, it should something like:
The Monit daemon 5.13 uptime: 2m
System 'example.com'
status Running
monitoring status Monitored
load average [0.48] [0.40] [0.81]
cpu 0.0%us 0.0%sy 0.0%wa
memory usage 8276900 kB [25.1%]
swap usage 1192 kB [0.0%]
data collected Thu, 03 Apr 2014 10:41:45
#many more lines...
You may also open example.com:2182 in your browser to use web-based interface.
Monit-Graph
You can use commercial version M/Monit for a lot many features or free script monit-graph
Install monit-graph
cd /var/www/example.com/htdocs
git clone https://github.com/danschultzer/monit-graph mg
cd mg
chmod -R 0777 data
chmod 0644 data/index.php
Config File
Open config.php and adjust following values:
"url" => "localhost:2812",
"url_ssl" => false,
"http_username" => "admin",
"http_password" => "easyengine",
Setup Cron
Add following line to cron:
* * * * * php /var/www/example.com/htdocs/mg/cron.php >> /var/log/monit-graph.log
View Graphs
You can open http://example.com/mg in browser to see visual graphs!
TODO
- monit check program for custom script to monitor php5-fpm status page and nginx status page.
- Explore: https://github.com/perusio/monit-miscellaneous/blob/master/php-fpm-tcp
- Explore: https://github.com/regilero/check_phpfpm_status
NewRelic Setup for Ubuntu Server with PHP, FPM, Nginx and MySQL
NEXT
Features
- Server Setup & Management
- Site Creation & Management
- Create WP Cloud Sites
- Speed & Caching
- Firewall Protection
- Backups & Recovery
- Logs & Monitoring
- Deployments & Developer Tools
- Team Access & User Permissions
Useful Links
Product
Other Products
Subscribe for curated product updates, tips, and announcements.
"*" indicates required fields
This field is for validation purposes and should be left unchanged.
Email*
SIGN ME UP
Δ
© rtCamp, since 2009. All rights reserved.