This the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

PHP-FPM

Metrics, Dashboards, Alerts and more for PHP-FPM Integration in Sysdig Monitor.
    PHP-FPM

    This integration is enabled by default.

    Versions supported: > 7.2

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

    This integration has 12 metrics.

    Timeseries generated: 167 timeseries

    List of Alerts

    AlertDescriptionFormat
    [Php-Fpm] Percentage of instances lowLess than 75% of instances are upPrometheus
    [Php-Fpm] Recently rebootInstances have been recently rebootPrometheus
    [Php-Fpm] Limit of child proccess exceededNumber of childs process have been exceededPrometheus
    [Php-Fpm] Reaching limit of queue processBuffer of queue requests reaching its limitPrometheus
    [Php-Fpm] Too slow requests processingRequests have taking too much time to be processedPrometheus

    List of Dashboards

    Php-fpm

    The dashboard provides information on the status of Php-fpm. Php-fpm

    List of Metrics

    Metric name
    kube_workload_status_desired
    phpfpm_accepted_connections
    phpfpm_active_processes
    phpfpm_idle_processes
    phpfpm_listen_queue
    phpfpm_listen_queue_length
    phpfpm_max_children_reached
    phpfpm_process_requests
    phpfpm_slow_requests
    phpfpm_start_since
    phpfpm_total_processes
    phpfpm_up

    Preparing the Integration

    Enable Status Path

    For the exporter to generate metrics, you need to configure some parameters in PHP-FPM to expose the status path. These configuration parameters are:

    • pm.status_path
    • listen

    Here is an example of how to configure them in Kubernetes:

    apiVersion: v1
    kind: ConfigMap
    metadata:
        labels:
          app: php-fpm
        name: php-fpm-config
        namespace: php-fpm
    data:
      www.conf: |
        [www]
        listen=127.0.0.1:9000
        pm.status_path=/status    
    
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: php-fpm-app
      namespace: php-fpm
      labels:
        app: php-fpm
        pod: php-app
    spec:
      selector:
        matchLabels:
          app: php-fpm
      replicas: 3
      template:
        metadata:
          labels:
            app: php-fpm
            pod: php-app
        spec:
          containers:
          - image: php:7.2-fpm
            imagePullPolicy: Always
            name: php-fpm
            ports:
            - containerPort: 9000
              protocol: TCP
            # Config-map include
            volumeMounts:
              - name: php-fpm-config
                mountPath: /usr/local/etc/php-fpm.d/www.conf
                subPath: www.conf
          volumes:
            - configMap:
                defaultMode: 420
                name: php-fpm-config
              name: php-fpm-config
    

    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/php-fpm-exporter

    Monitoring and Troubleshooting PHP-FPM

    This document describes important metrics and queries that you can use to monitor and troubleshoot PHP-FPM.

    Tracking metrics status

    You can track PHP-FPM metrics status with following alerts: Exporter proccess is not serving metrics

    # [PHP-FPM] Exporter Process Down
    absent(phpfpm_up{kube_cluster_name=~$cluster,kube_namespace_name=~$namespace,kube_workload_name=~$workload}) > 0
    

    Agent Configuration

    This is the default agent job for this integration:

    - job_name: php-fpm-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: drop
          source_labels: [__meta_kubernetes_pod_annotation_promcat_sysdig_com_omit]
          regex: true
        - action: replace
          source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scheme]
          target_label: __scheme__
          regex: (https?)
        - action: replace
          source_labels:
          - __meta_kubernetes_pod_container_name
          - __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
          regex: (php-fpm-exporter);(.{0}$)
          replacement: php-fpm
          target_label: __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
        - action: keep
          source_labels:
          - __meta_kubernetes_pod_annotation_promcat_sysdig_com_integration_type
          regex: "php-fpm"
        - 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
      metric_relabel_configs:
        - source_labels: [__name__]
          regex: (phpfpm_accepted_connections|phpfpm_active_processes|phpfpm_idle_processes|phpfpm_listen_queue|phpfpm_listen_queue_length|phpfpm_max_active_processes|phpfpm_max_children_reached|phpfpm_max_listen_queue|phpfpm_process_last_request_cpu|phpfpm_process_last_request_memory|phpfpm_process_request_duration|phpfpm_process_requests|phpfpm_process_state|phpfpm_scrape_failures|phpfpm_slow_requests|phpfpm_start_since|phpfpm_total_processes|phpfpm_up)
          action: keep