Apache

Metrics, Dashboards, Alerts and more for Apache Integration in Sysdig Monitor.
Apache

This integration is enabled by default.

Versions supported: 2.4

This integration uses a sidecar exporter that is available in UBI or scratch base image.

This integration has 11 metrics.

Timeseries generated: 100 timeseries

List of Alerts

AlertDescriptionFormat
[Apache] No Instance UpNo instances upPrometheus
[Apache] Up Time Less Than One HourInstance with UpTime less than one hourPrometheus
[Apache] Time Since Last OK Request More Than One HourTime since last OK request higher than one hourPrometheus
[Apache] High Error RateHigh error ratePrometheus
[Apache] High Rate Of Busy Workers In InstanceLow workers in open_slot statePrometheus

List of Dashboards

Apache App Overview

The dashboard provides information on the status of the Apache resources. Apache App Overview

List of Metrics

Metric name
apache_accesses_total
apache_connections
apache_cpuload
apache_duration_ms_total
apache_http_last_request_seconds
apache_http_response_codes_total
apache_scoreboard
apache_sent_kilobytes_total
apache_up
apache_uptime_seconds_total
apache_workers

Preparing the Integration

Create Grok Configuration

You need to add the Grok configuration in order to parse Apache logs and get metrics from them.

Install It Directly In Your Cluster

helm install -n Your-Application-Namespace apache-exporter --repo https://sysdiglabs.github.io/integrations-charts --set configmap=true

Download and Apply

You can download the file and execute the next command

kubectl -n Your-Application-Namespace apply -f grok-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: grok-config
data:
  config.yml: |
    global:
      config_version: 3
    input:
      type: file
      path: /tmp/logs/accesss.log
      fail_on_missing_logfile: false
      readall: true
    imports:
    - type: grok_patterns
      dir: ./patterns
    metrics:
    - type: counter
      name: apache_http_response_codes_total
      help: HTTP requests to Apache
      match: '%{COMMONAPACHELOG}'
      labels:
        code: '{{.response}}'
        method: '{{.verb}}'
    - type: gauge
      name: apache_http_response_bytes_total
      help: Size of HTTP responses
      match: '%{COMMONAPACHELOG}'
      value: '{{.bytes}}'
      cumulative: true
      labels:
        code: '{{.response}}'
        method: '{{.verb}}'
    - type: gauge
      name: apache_http_last_request_seconds
      help: Timestamp of the last HTTP request
      match: '%{COMMONAPACHELOG}'
      value: '{{timestamp "02/Jan/2006:15:04:05 -0700" .timestamp}}'
      labels:
        code: '{{.response}}'
        method: '{{.verb}}'
    server:
      protocol: http    

Check Apache Configuration

Apache provides metrics in its own format via its ServerStatus module. To enable this module, include (or uncomment) the following line in your apache configuration file:

LoadModule status_module modules/mod_status.so
<Location "/server-status">
  SetHandler server-status
</Location>

To configure Apache server to produce common logs, include (or uncomment) the following in your Apache configuration file:

<IfModule log_config_module>
       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
       CustomLog /usr/local/apache2/logs/accesss.log common
</IfModule>

Installing

An automated wizard is present in the Monitoring Integrations in Sysdig Monitor. However, you can also use this Helm chart for expert users: https://github.com/sysdiglabs/integrations-charts/tree/main/charts/apache-exporter

Monitoring and Troubleshooting Apache

This document describes important metrics and queries that you can use to monitor and troubleshoot Apache.

Tracking metrics status

You can track Apache metrics status with following alerts: Exporter proccess is not serving metrics

# [Apache] Exporter Process Down
absent(apache_up{kube_cluster_name=~$cluster,kube_namespace_name=~$namespace,kube_workload_name=~$workload}) > 0

Agent Configuration

These are the default agent jobs for this integration:

- job_name: apache-exporter-default
  tls_config:
    insecure_skip_verify: true
  kubernetes_sd_configs:
  - role: pod
  relabel_configs:
  - action: keep
    source_labels: [__meta_kubernetes_pod_host_ip]
    regex: __HOSTIPS__
  - action: keep
    source_labels:
    - __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
    regex: "apache"
  - action: replace
    source_labels: [__address__,__meta_kubernetes_pod_container_port_number]
    regex: ([^:]+)(?::\d+)?;(\d+)
    replacement: $1:9117
    target_label: __address__
  - action: replace
    source_labels: [__meta_kubernetes_pod_uid]
    target_label: sysdig_k8s_pod_uid
  - action: replace
    source_labels: [__meta_kubernetes_pod_container_name]
    target_label: sysdig_k8s_pod_container_name
- job_name: apache-grok-default
  tls_config:
    insecure_skip_verify: true
  kubernetes_sd_configs:
  - role: pod
  relabel_configs:
  - action: keep
    source_labels: [__meta_kubernetes_pod_host_ip]
    regex: __HOSTIPS__
  - action: keep
    source_labels:
    - __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
    regex: "apache"
  - action: replace
    source_labels: [__address__,__meta_kubernetes_pod_container_port_number]
    regex: ([^:]+)(?::\d+)?;(\d+)
    replacement: $1:9144
    target_label: __address__
  - action: replace
    source_labels: [__meta_kubernetes_pod_uid]
    target_label: sysdig_k8s_pod_uid
  - action: replace
    source_labels: [__meta_kubernetes_pod_container_name]
    target_label: sysdig_k8s_pod_container_name