Centreon : Supervision apache
par
popularité : 6%
Préparation de la configuration apache :
Dans notre exemple le serveur WEB a pour nom : WEB001 / 192.168.141.40
<IfModule mod_status.c>
<Directory /var/www>
AuthUserFile /var/www/.htpasswd_status
AuthName "Identifiez vous :"
AuthType Basic
Require valid-user
</Directory>
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 192.168.1.2 10.0.2.3 #à modifier ;)
</Location>
</IfModule>
htpasswd -c /var/www/.htpassword_status supervision
New password : xxxxxxxx
Re-type new password : xxxxxxxx
Adding password for user supervision
Plugin centreon
Le répertoire /var/lib/centreon/centplugins/ contiendra
# ./centreon_plugins.pl plugin=apps::apache::serverstatus::plugin list-mode
Plugin Description :
Check Apache and Apache 2 Web Servers through server-status webpage
Global Options :
* mode Choose a mode.
* dyn-mode
Specify a mode with the path (separated by ’ : :’).
* list-mode
List available modes.
* mode-version
Check minimal version of mode. If not, unknown error.
* version
Display plugin version.
Modes Available :
cpuload
requests
responsetime
slotstates
workers
Exemple de commande et résultat :
./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* mode=slotstates* hostname=192.168.141.40* username=supervision* password=centreon* credentials
OK : Slots Busy : 10 (3.91 %), Free : 246 (96.09 %), Waiting : 9 (3.52 %), Starting : 0 (0.00 %), Reading : 0 (0.00 %), Sending : 1 (0.39 %), Keepalive : 0 (0.00 %), Dns Lookup : 0 (0.00 %), Gracefuly Finished : 0 (0.00 %), Idle Cleanup Worker : 0 (0.00 %), Closing : 0 (0.00 %), Logging : 0 (0.00 %) | ’busy’=10 ; ; ;0 ;256 ’free’=246 ; ; ;0 ;256 ’waiting’=9 ; ; ;0 ;256 ’starting’=0 ; ; ;0 ;256 ’reading’=0 ; ; ;0 ;256 ’sending’=1 ; ; ;0 ;256 ’keepalive’=0 ; ; ;0 ;256 ’dns_lookup’=0 ; ; ;0 ;256 ’gracefuly_finished’=0 ; ; ;0 ;256 ’idle_cleanup_worker’=0 ; ; ;0 ;256 ’closing’=0 ; ; ;0 ;256 ’logging’=0 ; ; ;0 ;256
-----------------------------------------
./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* hostname=192.168.141.40* username=supervision* password=centreon* credentials* mode=workers
OK : Busy workers : 1 Idle workers : 9 (Server Limit : 256 - 0 % Busy) | ’idle_workers’=9 ; ; ;0 ;256 ’busy_workers’=1 ; ; ;0 ;256
-----------------------------------------
/plugins/centreon-plugins# ./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* hostname=192.168.141.40* username=supervision* password=centreon* credentials* mode=requests
OK : Buffer creation... | ==> Uniquement la premiere fois
/plugins/centreon-plugins# ./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* hostname=192.168.141.40* username=supervision* password=centreon* credentials* mode=requests
OK : BytesPerSec : 128.00 B AccessPerSec : 0.12 RequestPerSec : 0.02 BytesPerRequest : 29.38 KB | ’avg_RequestPerSec’=0.02 ; ; ;0 ; ’bytesPerSec’=128.00B ; ; ;0 ; ’avg_bytesPerRequest’=30082.6B ; ; ;0 ; ’avg_bytesPerSec’=527.902B ; ; ;0 ; ’accessPerSec’=0.12 ; ; ;0 ;
-----------------------------------------
./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* hostname=192.168.141.40* username=supervision* password=centreon* credentials* mode=responsetime
OK : Response time 0.035s | ’time’=0.035s ; ; ;0 ;
---------------------------------------
./centreon_plugins.pl* plugin=apps::apache::serverstatus::plugin* hostname=192.168.141.40* username=supervision* password=centreon* credentials* mode=cpuload
OK : CPU Load : 0.00 % | ’cpuload’=0.00% ; ; ;0 ;
Configuration centreon :
Ajout d’une commande :
La commande est "check_centreon_plugin_http" :
$CENTREONPLUGINS$/centreon_plugins.pl --plugin=$_SERVICEPLUGIN$ --hostname=$HOSTADDRESS$ --mode=$_SERVICEMODE$ --username=$_SERVICEUSERNAME$ --password=$_SERVICEPASSWORD$&nbsp; --warning=$_SERVICEWARNING$ --critical=$_SERVICECRITICAL$ $_SERVICEOPTION$
Ajout du modele générique :
Création : Modele-check_centreon_plugin_http
check_command ;check_centreon_plugin_http
PLUGIN ;apps::apache::serverstatus::plugin
USERNAME ;supervision
PASSWORD ;centreon ;1
OPTION ; —credentials