IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Shell et commandes GNU Discussion :

Script shell pour tester le temps de réponse d'Apache


Sujet :

Shell et commandes GNU

  1. #1
    Membre averti Avatar de Joe Le Mort
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    392
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2006
    Messages : 392
    Points : 388
    Points
    388
    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

  2. #2
    Rédacteur
    Avatar de _Mac_
    Profil pro
    Inscrit en
    Août 2005
    Messages
    9 601
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2005
    Messages : 9 601
    Points : 12 977
    Points
    12 977
    Par défaut
    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.

  3. #3
    Membre averti Avatar de Joe Le Mort
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    392
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2006
    Messages : 392
    Points : 388
    Points
    388
    Par défaut
    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 !

  4. #4
    Modérateur
    Avatar de ggnore
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    2 472
    Détails du profil
    Informations personnelles :
    Âge : 45
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 2 472
    Points : 4 029
    Points
    4 029
    Par défaut
    je te conseille plutôt d'installer monit.
    Sauf si bien entendu le but est d'apprendre les scripts shell ...

  5. #5
    Rédacteur/Modérateur

    Avatar de gorgonite
    Homme Profil pro
    Ingénieur d'études
    Inscrit en
    Décembre 2005
    Messages
    10 322
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur d'études
    Secteur : Transports

    Informations forums :
    Inscription : Décembre 2005
    Messages : 10 322
    Points : 18 681
    Points
    18 681
    Par défaut
    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...)

  6. #6
    Membre averti Avatar de Joe Le Mort
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    392
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Avril 2006
    Messages : 392
    Points : 388
    Points
    388
    Par défaut
    Merci pour ces liens

  7. #7
    Membre éprouvé
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    792
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Mai 2004
    Messages : 792
    Points : 1 206
    Points
    1 206
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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)

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Script shell pour man en troff vers pdf
    Par bxflash dans le forum Shell et commandes GNU
    Réponses: 1
    Dernier message: 30/10/2006, 08h40
  2. Script shell pour tester si un répertoire est vide ou pas
    Par Ito dans le forum Shell et commandes GNU
    Réponses: 3
    Dernier message: 04/10/2006, 17h44
  3. Script shell pour modifier plusieurs fichiers
    Par julio_097 dans le forum Shell et commandes GNU
    Réponses: 10
    Dernier message: 03/10/2006, 12h41
  4. Script shell pour persister les variables exportées
    Par Giovanny Temgoua dans le forum Shell et commandes GNU
    Réponses: 4
    Dernier message: 03/10/2006, 09h07
  5. [GML] Scripts shell pour extraire des données d'Oracle
    Par diamonds dans le forum XQUERY/SGBD
    Réponses: 1
    Dernier message: 28/09/2006, 07h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo