Skip to content

Instantly share code, notes, and snippets.

@althaus
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save althaus/11212983 to your computer and use it in GitHub Desktop.
Save althaus/11212983 to your computer and use it in GitHub Desktop.
#! /bin/bash
#
# Install Munin plugin for PHP APC (Alternative PHP Cache)
#
# Required : Debian/Ubuntu, Munin-node > 1.4.0, Apc, Apache, some time
#
# You need to be root
#
# Inspired by http://kevin.deldycke.com/2011/07/php-apc-debian-squeeze-munin-monitoring/
# Reference : http://munin-php-apc.googlecode.com
#
# THIS SCRIPT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND
# 1 step get apc_info.php
cd /var/www
mkdir munin-apc
cd munin-apc/
wget https://raw.githubusercontent.com/vivid-planet/munin-php-apc/master/apc_info.php
# add an alias
echo "
Alias /munin-apc /var/www/munin-apc
<Directory /var/www/munin-apc>
Order Allow,Deny
Allow from 127.0.0.1
</Directory>
" > /etc/apache2/conf.d/munin-apc.conf
/etc/init.d/apache2 reload
# 2nd step install munin plugin
aptitude install libwww-perl
wget https://raw.githubusercontent.com/vivid-planet/munin-php-apc/master/php_apc_ --output-document=/usr/share/munin/plugins/php_apc_
chmod 755 /usr/share/munin/plugins/php_apc_
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_usage
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_hit_miss
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_purge
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_fragmentation
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_files
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_rates
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_mem_size
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_user_purge
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_user_mem_size
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_user_hit_miss
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_user_entries
ln -s /usr/share/munin/plugins/php_apc_ /etc/munin/plugins/php_apc_user_rates
echo "[php_apc_*]
user root
env.url http://localhost/munin-apc/apc_info.php?auto
" > /etc/munin/plugin-conf.d/php_apc
/etc/init.d/munin-node restart
@althaus
Copy link
Author

althaus commented Apr 23, 2014

Forked the Gist to use the more active fork of @nsams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment