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

Prerequisites

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>

Installation

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

Agent Configuration

The default agent jobs for this integration are as follows:

- 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"
  - source_labels: [__meta_kubernetes_pod_phase]
    action: keep
    regex: Running
  - 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"
  - source_labels: [__meta_kubernetes_pod_phase]
    action: keep
    regex: Running
  - 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