Précédent   Forum des professionnels en informatique > Systèmes > Linux > Applications > Shell
Shell Vos questions sur l'utilisation des commandes shell
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 11/07/2007, 10h06   #1
Membre éclairé
 
Avatar de Joe Le Mort
 
Inscription : avril 2006
Messages : 392
Détails du profil
Informations personnelles :
Âge : 30
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : avril 2006
Messages : 392
Points : 361
Points : 361
Envoyer un message via MSN à Joe Le Mort
Par défaut Script shell pour tester le temps de réponse d'Apache

bonjour,

J'aimerais faire un script qui teste le temps de réponse d'Apache.
Le fonctionnement souhaité :

Si le temsp de réponse d'apache > XX sec alors restart apache.

Etant donné que je ne maitrise pas du tout le script shell, quelqu'un pourrait m'aider ?

merci
__________________
Tuxboard Blog d'actu Buzz...
Video de sport
Joe Le Mort est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2007, 11h46   #2
Rédacteur/Modérateur
 
Avatar de _Mac_
 
Inscription : août 2005
Messages : 8 311
Détails du profil
Informations forums :
Inscription : août 2005
Messages : 8 311
Points : 8 592
Points : 8 592
Faut utiliser un outil du style wget, c'est tout ce que je peux te dire. Pose éventuellement ta question sur le forum Linux/Shell si tu as des pbs avec wget et le shell.

Tu as la possibilité de regarder les fichiers de log, aussi : souvent, on y fait figurer le temps de traitement des requêtes, mais ce n'est pas forcément ce que tu cherches à savoir.
__________________

Du détail, du détail, du détail !!!
Revenons à la source : lisons la documentation et les fichiers de trace, la réponse à notre problème s'y trouve sans doute
_Mac_ est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2007, 15h08   #3
Membre éclairé
 
Avatar de Joe Le Mort
 
Inscription : avril 2006
Messages : 392
Détails du profil
Informations personnelles :
Âge : 30
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : avril 2006
Messages : 392
Points : 361
Points : 361
Envoyer un message via MSN à Joe Le Mort
nan, en fait je veux controler que apache réponde dans un délai suffisant.

Faire un genre de cron qui tourne toutes les 20 minutes et qui teste si le tps de rép d'apache est correct !
__________________
Tuxboard Blog d'actu Buzz...
Video de sport
Joe Le Mort est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2007, 15h17   #4
Modérateur
 
Avatar de ggnore
 
Inscription : juillet 2004
Messages : 2 246
Détails du profil
Informations personnelles :
Âge : 33

Informations forums :
Inscription : juillet 2004
Messages : 2 246
Points : 1 904
Points : 1 904
je te conseille plutôt d'installer monit.
Sauf si bien entendu le but est d'apprendre les scripts shell ...
__________________
Toutes les vertus des hommes se perdent dans l’intérêt comme les fleuves se perdent dans la mer.
ggnore est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2007, 15h17   #5
Rédacteur/Modérateur
 
Avatar de gorgonite
 
Homme Nicolas Vallée
Ingénieur Système
Inscription : décembre 2005
Messages : 9 774
Détails du profil
Informations personnelles :
Nom : Homme Nicolas Vallée
Âge : 27
Localisation : France

Informations professionnelles :
Activité : Ingénieur Système
Secteur : Transports

Informations forums :
Inscription : décembre 2005
Messages : 9 774
Points : 14 303
Points : 14 303
perso, je te conseille d'utiliser le plugin apache loadtime de munin... qui peut tourner en standalone bien sûr

http://munin.projects.linpro.no/wiki...pache-loadtime


au moins, tu as un script prêt à l'emploi (c'est du shell avec wget...)
__________________
Evitez les MP pour les questions techniques... il y a des forums
Contributions sur DVP : Mes Tutos | Mon Blog
gorgonite est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 11/07/2007, 15h41   #6
Membre éclairé
 
Avatar de Joe Le Mort
 
Inscription : avril 2006
Messages : 392
Détails du profil
Informations personnelles :
Âge : 30
Localisation : France, Rhône (Rhône Alpes)

Informations forums :
Inscription : avril 2006
Messages : 392
Points : 361
Points : 361
Envoyer un message via MSN à Joe Le Mort
Merci pour ces liens
__________________
Tuxboard Blog d'actu Buzz...
Video de sport
Joe Le Mort est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 16/07/2007, 21h14   #7
Membre émérite
 
Inscription : mai 2004
Messages : 709
Détails du profil
Informations personnelles :
Localisation : Belgique

Informations forums :
Inscription : mai 2004
Messages : 709
Points : 852
Points : 852
Et pourquoi pas simplement avec curl qui renvoie un timing beaucoup plus détaillé qu'un $ time wget etc....?

Exemple simple à partir duquel il sera facile de récupérer les valeurs dans des variables pour faire des tests de réactivité dans un script (avec envoi de mail si trop lent).

Code :
1
2
3
4
5
6
7
#! /bin/bash
 
URL=www.developpez.net
 
FORMAT="%{time_namelookup} %{time_connect} %{time_starttransfer} %{time_total}"
 
curl -w "$FORMAT" $URL
CURL fourni des tas de variables statistiques. Voir man curl dont voici un extrait (il y a de quoi faire):

Code :
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
Available variables are at this point:
 
              url_effective  The  URL  that  was fetched last. This is mostly meaningful if you’ve told curl to follow
                             location: headers.
 
              http_code      The numerical code that was found in the last retrieved HTTP(S) page.
 
              http_connect   The numerical code that was found in the last response (from a proxy) to a  curl  CONNECT
                             request. (Added in 7.12.4)
 
              time_total     The  total  time,  in seconds, that the full operation lasted. The time will be displayed
                             with millisecond resolution.
 
              time_namelookup
                             The time, in seconds, it took from the start until the name resolving was completed.
 
              time_connect   The time, in seconds, it took from the start until the connect to  the  remote  host  (or
                             proxy) was completed.
 
              time_pretransfer
                             The  time,  in  seconds,  it took from the start until the file transfer is just about to
                             begin. This includes all pre-transfer commands and negotiations that are specific to  the
                             particular protocol(s) involved.
 
              time_redirect  The  time,  in  seconds,  it took for all redirection steps include name lookup, connect,
                             pretransfer and transfer before final transaction was started.  time_redirect  shows  the
                             complete execution time for multiple redirections. (Added in 7.12.3)
 
              time_starttransfer
                             The  time,  in  seconds,  it took from the start until the first byte is just about to be
                             transferred. This includes time_pretransfer and also the time the server needs to  calcu‐
                             late the result.
 
              size_download  The total amount of bytes that were downloaded.
 
              size_upload    The total amount of bytes that were uploaded.
 
              size_header    The total amount of bytes of the downloaded headers.
 
              size_request   The total amount of bytes that were sent in the HTTP request.
 
              speed_download The average download speed that curl measured for the complete download.
 
              speed_upload   The average upload speed that curl measured for the complete upload.
 
              content_type   The Content-Type of the requested document, if there was any.
 
              num_connects   Number of new connects made in the recent transfer. (Added in 7.12.3)
 
              num_redirects  Number of redirects that were followed in the request. (Added in 7.12.3)
__________________
:q :q! :wq :w :w! :wq! :quit :quit! :help help helpquit quit quithelp
:quitplease :quitnow :leave :shit ^X^C ^C ^D ^Z ^Q QUITDAMMIT
Jabber: ripat at im.apinc.org
ripat est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h37.


 
 
 
 
Partenaires

Hébergement Web