Skip to content

Instantly share code, notes, and snippets.

@keesschepers
Created March 13, 2012 08:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keesschepers/2027613 to your computer and use it in GitHub Desktop.
Save keesschepers/2027613 to your computer and use it in GitHub Desktop.
Install-Munin-Plugin-Apc-Apache-CentOs
#! /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 http://munin-php-apc.googlecode.com/svn/trunk/php_apc/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/httpd/conf.d/munin-apc.conf
/etc/init.d/httpd reload
# 2nd step install munin plugin
yum install libwww-perl
wget http://munin-php-apc.googlecode.com/svn/trunk/php_apc/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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment