1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| # Algorithme pour script apache
Execute commande "apachectl fullstatus" >> $resultat
Open FICHIER ">resultat.txt"
print FICHIER "$resultat"
Close FICHIER
==============================
# Premier test : nombres de requêtes par seconde
Open FICHIER "<resultat.txt"
Find X "requests/sec"
$X=X
opcmon opcmon MAPOLICY=$X -option requestspsec=$X
Close FICHIER
==============================
# Deuxième test : nombre d'octets par seconde
Open FICHIER "<resultat.txt"
Find Y "B/second"
$Y=Y
opcmon MAPOLICY=$Y -option bpsecond=$Y
Close FICHIER
=============================
# Troisième test : nombre de workers actif et d'idle, et pourcentage de workers occupés
Open FICHIER "<resultat.txt"
Find W "requests currently being processed," I "idle workers"
$W=W
$I=I
$Z=($W*100)/($W+$I)
opcmon MAPOLICY=$Z -option pourcentworkersoccupes=$Z -option workersactifs=$W -option idle=$I
Close FICHIER
=============================
#Quatrième test : pourcentage utilisation cache ssl
Open FICHIER "<resultat.txt"
Find "cache usage:" V"%"
$V=V
opcmon MAPOLICY=$V -option cacheusage=$V
Close FICHIER
=============================
#Cinquième test : etats des membres du loadbalancer
Open FICHIER "<resultat.txt"
Find "ajp" R S
$R=R
$S=S
If ($S=OK
Then $S=1)
else ($S=0)
opcmon MAPOLICY=$S -option name=$R -option state=$S
Close FICHIER |