Skip to main content

Monitoring

Ajout

Ajouter deun laDashboard confgurationpour un serveur Apache dans google cloud

Installer l'agent sur le serveur : 

(cd:> /etc/apache2/sites-available/agents_to_install.csv && sudo\
echo '"projects/XXXXXXXXX/zones/europe-west1-b/instances/YYYYYYYYYY","[{""type"":""ops-agent""}]"' >> agents_to_install.csv && \
curl -OsSO https://raw.githubusercontent.dl.google.com/Stackdriver/stackdriver-agent-service-configs/master/etc/httpd/conf.d/status.conf)cloudagents/mass-provision-google-cloud-ops-agents.py && \
python3 mass-provision-google-cloud-ops-agents.py --file agents_to_install.csv

EnableAssurez-vous d'avoir un agent de version 2.7 ou plus ! 

 

Vérifier que le serveur apache renvoie bien un statut

a2ensitecurl statuslocalhost:80/server-status?auto
systemctlServerVersion: reloadApache/XXXXX apache2(Debian) OpenSSL/XXXXXX
ServerMPM: prefork
Server Built: 2022-06-20T19:03:00
CurrentTime: Saturday, 25-Feb-2023 01:06:32 UTC
RestartTime: Saturday, 25-Feb-2023 00:47:07 UTC
ParentServerConfigGeneration: 4
ParentServerMPMGeneration: 3
ServerUptimeSeconds: 1165
ServerUptime: 19 minutes 25 seconds
Load1: 0.04
Load5: 0.08
Load15: 0.18
Total Accesses: 119
Total kBytes: 1445
Total Duration: 96516
CPUUser: .66
CPUSystem: .29
CPUChildrenUser: 10.2
CPUChildrenSystem: 2.38
CPULoad: 1.16137
Uptime: 1165

Configurer l'agent sur le serveur : 

# Configures Ops Agent to collect telemetry from the app and restart Ops Agent.

set -e

# Create a back up of the existing file so existing configurations are not lost.
sudo cp /etc/google-cloud-ops-agent/config.yaml /etc/google-cloud-ops-agent/config.yaml.bak

# Configure the Ops Agent.
sudo tee /etc/google-cloud-ops-agent/config.yaml > /dev/null << EOF
metrics:
  receivers:
    apache:
      type: apache
  service:
    pipelines:
      apache:
        receivers:
          - apache
logging:
  receivers:
    apache_access:
      type: apache_access
    apache_error:
      type: apache_error
  service:
    pipelines:
      apache:
        receivers:
          - apache_access
          - apache_error
EOF

sudo service google-cloud-ops-agent restart

 

Importer le Dashboard :