Révision 06b838f2
Initial version
| plugins/other/eaccelerator | ||
|---|---|---|
| 1 |
#!/bin/sh |
|
| 2 |
################################################################# |
|
| 3 |
# |
|
| 4 |
# Script to monitor eaccelerator usage |
|
| 5 |
# This code works only with mod_php or PHP in fastcgi, read here why in Requirements section : http://eaccelerator.net/wiki/InstallFromSource |
|
| 6 |
# |
|
| 7 |
################################################################# |
|
| 8 |
# |
|
| 9 |
# Parameters understood: |
|
| 10 |
# |
|
| 11 |
# config (required) |
|
| 12 |
# autoconf (optional - used by munin-config) |
|
| 13 |
# |
|
| 14 |
################################################################# |
|
| 15 |
# |
|
| 16 |
# Requirements |
|
| 17 |
# - web server with PHP and eaccelerator enabled |
|
| 18 |
# - php file placed on web server , paste there below code (strip hash files first) |
|
| 19 |
# |
|
| 20 |
# <?php |
|
| 21 |
# $error_reporting(E_NONE); |
|
| 22 |
# // notice keys orders is very important |
|
| 23 |
# $keys = array("memorySize"=>0,"memoryAvailable"=>0,"memoryAllocated"=>0,"cachedScripts"=>0,"removedScripts"=>0,"cachedKeys"=>0);
|
|
| 24 |
# if(!function_exists("eaccelerator_info"))
|
|
| 25 |
# $info = $keys; |
|
| 26 |
# else |
|
| 27 |
# $info = eaccelerator_info(); |
|
| 28 |
# foreach($keys as $key => $val) echo strtolower($key).".value ".$info[$key]."\n"; |
|
| 29 |
# ?> |
|
| 30 |
# |
|
| 31 |
# - name that file eaccelerator_status.php, will be easier, file should be at least accesible from the address that runs this script (usally localhost) |
|
| 32 |
# you can make this file accessible globally, it just displays the memor usage by eaccelerator, thats all. |
|
| 33 |
# usually you can put it to the /var/www/ (but it depends on the server configuration etc) |
|
| 34 |
# - check if you can see the output of the file, for example if you placed file in the DocumentRoot then it should be available from |
|
| 35 |
# http://localhost/eaccelerator_status.php |
|
| 36 |
# if you see the plain text with values then its working ok! |
|
| 37 |
# if you see the plain text and all values are zero then probalby eaccelerator is not enabled. |
|
| 38 |
# - installed wget |
|
| 39 |
# |
|
| 40 |
################################################################# |
|
| 41 |
# |
|
| 42 |
# Configuration section |
|
| 43 |
# |
|
| 44 |
# URL to the script to check eaccelerator status |
|
| 45 |
URL="http://localhost/eaccelerator_status.php"; |
|
| 46 |
# |
|
| 47 |
WGET=`which wget`; |
|
| 48 |
WGET_FLAGS="-Yoff"; # refer to wget manual, you may set extra parameters like disable proxy |
|
| 49 |
# |
|
| 50 |
# |
|
| 51 |
################################################################# |
|
| 52 |
# |
|
| 53 |
# Changelog |
|
| 54 |
# |
|
| 55 |
# Revision 0.1 Tue 03 Feb 2009 02:16:02 PM CET _KaszpiR_ |
|
| 56 |
# - initial release, |
|
| 57 |
# |
|
| 58 |
################################################################# |
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
################################################################# |
|
| 64 |
################################################################# |
|
| 65 |
# Settigs required for autoconf |
|
| 66 |
#%# family=manual |
|
| 67 |
#%# capabilities=autoconf |
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
|
| 71 |
if [ "$1" = "autoconf" ]; then |
|
| 72 |
echo no |
|
| 73 |
exit 0 |
|
| 74 |
fi |
|
| 75 |
|
|
| 76 |
if [ "$1" = "config" ]; then |
|
| 77 |
|
|
| 78 |
echo 'graph_title Eaccelerator usage ' |
|
| 79 |
echo 'graph_args -l 0' |
|
| 80 |
echo 'graph_category apache' |
|
| 81 |
echo 'graph_info This graph shows performance of the eaccelerator module on WWW server.' |
|
| 82 |
|
|
| 83 |
echo 'memorysize.label total' |
|
| 84 |
echo 'memorysize.draw AREA' |
|
| 85 |
echo 'memorysize.min 0' |
|
| 86 |
echo 'memorysize.info Total memory allocated by eaccelerator.' |
|
| 87 |
|
|
| 88 |
echo 'memoryallocated.label allocated' |
|
| 89 |
echo 'memoryallocated.draw AREA' |
|
| 90 |
echo 'memoryallocated.min 0' |
|
| 91 |
# echo "memoryallocated.warning 92" |
|
| 92 |
# echo "memoryallocated.critical 98" |
|
| 93 |
echo 'memoryallocated.info Memory allocated .' |
|
| 94 |
|
|
| 95 |
echo 'memoryavailable.label available' |
|
| 96 |
echo 'memoryavailable.min 0' |
|
| 97 |
echo 'memoryavailable.info Memory available .' |
|
| 98 |
|
|
| 99 |
echo 'cachedscripts.label cached scripts' |
|
| 100 |
echo 'cachedscripts.min 0' |
|
| 101 |
echo 'cachedscripts.info Scripts cached.' |
|
| 102 |
|
|
| 103 |
echo 'removedscripts.label removed scripts' |
|
| 104 |
echo 'removedscripts.min 0' |
|
| 105 |
echo 'removedscripts.info Scripts removed.' |
|
| 106 |
|
|
| 107 |
echo 'cachedkeys.label cached keys' |
|
| 108 |
echo 'cachedkeys.min 0' |
|
| 109 |
echo 'cachedkeys.info Scripts removed.' |
|
| 110 |
|
|
| 111 |
|
|
| 112 |
|
|
| 113 |
# for key in $KEYS_WARN; do |
|
| 114 |
# echo "$key.warning 92" |
|
| 115 |
# echo "$key.critical 98" |
|
| 116 |
# exit 0 |
|
| 117 |
fi |
|
| 118 |
|
|
| 119 |
|
|
| 120 |
|
|
| 121 |
################################################################# |
|
| 122 |
# run the sript |
|
| 123 |
if [ -x $WGET ]; then |
|
| 124 |
# quiet output to stdout |
|
| 125 |
wget -q $WGET_FLAGS "$URL" -O - |
|
| 126 |
exit 0 |
|
| 127 |
fi |
|
| 128 |
|
|
| 129 |
exit 0 |
|
| 130 |
|
|
| 131 |
# end of file |
|
Formats disponibles : Unified diff