Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / php / eaccelerator @ 09b88141

Historique | Voir | Annoter | Télécharger (3,88 ko)

1 06b838f2 _KaszpiR_
#!/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 17f78427 Lars Kruse
#   $error_reporting(E_NONE);
22
#   // notice keys orders is very important
23 06b838f2 _KaszpiR_
#   $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 8713eb37 Lars Kruse
# - name that file eaccelerator_status.php, will be easier, file should be at least accessible from the address that runs this script (usually localhost)
32
#   you can make this file accessible globally, it just displays the memory usage by eaccelerator, that's all.
33 06b838f2 _KaszpiR_
#   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 8713eb37 Lars Kruse
#   if you see the plain text and all values are zero then probably eaccelerator is not enabled.
38 17f78427 Lars Kruse
# - installed wget
39 06b838f2 _KaszpiR_
#
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 17f78427 Lars Kruse
# - initial release,
57
#
58 06b838f2 _KaszpiR_
#################################################################
59
60
61
62
63
#################################################################
64
#################################################################
65 36748826 Lars Kruse
# Settings required for autoconf
66 06b838f2 _KaszpiR_
#%# 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 3c98d069 dipohl
	echo 'graph_category webserver'
81 06b838f2 _KaszpiR_
	echo 'graph_info This graph shows performance of the eaccelerator module on WWW server.'
82 17f78427 Lars Kruse
83 06b838f2 _KaszpiR_
	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 17f78427 Lars Kruse
95 06b838f2 _KaszpiR_
	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