Skip to content

Commit 89f1fb6

Browse files
Merge pull request #162 from sysdiglabs/nginx_config
Add config for nginx and nginx ingress
2 parents 6f22d01 + b2c8ec7 commit 89f1fb6

File tree

6 files changed

+93
-12
lines changed

6 files changed

+93
-12
lines changed

apps/nginx-ingress.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: App
44
name: "Nginx-Ingress"
55
keywords:
6+
- Load-balancer
67
- Kubernetes
78
- Available
89
availableVersions:

resources/nginx-ingress/INSTALL.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,29 @@ controller:
1010
# if this port is changed, change healthz-port: in extraArgs: accordingly
1111
enabled: true
1212
podAnnotations:
13-
prometheus.io/scrape: "true"
14-
prometheus.io/port: "10254"
13+
promcat.sysdig.com/port: "10254"
1514
```
1615
1716
# Sysdig Agent configuration
1817
For the Sysdig Agent to discover and scrape the ngnix ingress controller automatically, enable the `use_promscrape` option in the agent configuration.
1918

2019
```yaml
2120
dragent.yaml: |-
21+
metrics_excess_log: true
22+
k8s_cluster_name: YourClusterName
23+
10s_flush_enable: true
24+
app_checks_enabled: false
2225
use_promscrape: true
26+
new_k8s: true
27+
promscrape_fastproto: true
2328
prometheus:
2429
enabled: true
2530
prom_service_discovery: true
31+
log_errors: true
32+
max_metrics: 200000
33+
max_metrics_per_process: 200000
34+
max_tags_per_metric: 100
35+
ingest_raw: true
36+
ingest_calculated: false
2637
```
2738
An example of the Sysdig Agent configuration file is given below.

resources/nginx-ingress/include/sysdig-agent.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,37 @@ metadata:
44
name: sysdig-agent
55
namespace: sysdig-agent
66
data:
7+
prometheus.yaml: |
8+
global:
9+
scrape_interval: 10s
10+
scrape_configs:
11+
- job_name: nginx-ingress-default
12+
tls_config:
13+
insecure_skip_verify: true
14+
kubernetes_sd_configs:
15+
- role: pod
16+
relabel_configs:
17+
- action: keep
18+
source_labels: [__meta_kubernetes_pod_host_ip]
19+
regex: __HOSTIPS__
20+
- action: keep
21+
source_labels:
22+
- __meta_kubernetes_namespace
23+
- __meta_kubernetes_pod_name
24+
separator: '/'
25+
# Add here the namespace/pod-name of your nginx-ingress exporter instance
26+
regex: 'nginx-namespace/nginx-ingress-.+'
27+
- action: replace
28+
source_labels: [__address__, __meta_kubernetes_pod_annotation_promcat_sysdig_com_port]
29+
regex: ([^:]+)(?::\d+)?;(\d+)
30+
replacement: $1:$2
31+
target_label: __address__
32+
- action: replace
33+
source_labels: [__meta_kubernetes_pod_uid]
34+
target_label: sysdig_k8s_pod_uid
35+
- action: replace
36+
source_labels: [__meta_kubernetes_pod_container_name]
37+
target_label: sysdig_k8s_pod_container_name
738
dragent.yaml: |-
839
metrics_excess_log: true
940
k8s_cluster_name: YourClusterName

resources/nginx/INSTALL.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ Note that the deployment has a label, `app`. This label will be included in the
66
# Sysdig Agent configuration
77
In the Sysdig Agent configuration, add the following snippet to include the label `app` as a metric label.
88
```yaml
9-
process_filter:
10-
- include:
11-
kubernetes.pod.annotation.prometheus.io/scrape: true
12-
conf:
13-
path: "{kubernetes.pod.annotation.prometheus.io/path}"
14-
port: "{kubernetes.pod.annotation.prometheus.io/port}"
15-
tags:
16-
app: "{kubernetes.pod.label.app}"
9+
dragent.yaml: |-
10+
metrics_excess_log: true
11+
k8s_cluster_name: YourClusterName
12+
10s_flush_enable: true
13+
app_checks_enabled: false
14+
use_promscrape: true
15+
new_k8s: true
16+
promscrape_fastproto: true
17+
prometheus:
18+
enabled: true
19+
prom_service_discovery: true
20+
log_errors: true
21+
max_metrics: 200000
22+
max_metrics_per_process: 200000
23+
max_tags_per_metric: 100
24+
ingest_raw: true
25+
ingest_calculated: false
1726
```
1827
1928
You can download the sample configuration file below and apply it by:

resources/nginx/include/configuration.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ spec:
1212
labels:
1313
app: nginx-A
1414
annotations:
15-
prometheus.io/scrape: "true"
16-
prometheus.io/port: "9113"
15+
promcat.sysdig.com/port: "9113"
1716
spec:
1817
containers:
1918
- name: nginx

resources/nginx/include/sysdig-agent-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@ metadata:
44
name: sysdig-agent
55
namespace: sysdig-agent
66
data:
7+
prometheus.yaml: |
8+
global:
9+
scrape_interval: 10s
10+
scrape_configs:
11+
- job_name: nginx-default
12+
tls_config:
13+
insecure_skip_verify: true
14+
kubernetes_sd_configs:
15+
- role: pod
16+
relabel_configs:
17+
- action: keep
18+
source_labels: [__meta_kubernetes_pod_host_ip]
19+
regex: __HOSTIPS__
20+
- action: keep
21+
source_labels:
22+
- __meta_kubernetes_namespace
23+
- __meta_kubernetes_pod_name
24+
separator: '/'
25+
regex: 'nginx-namespace/nginx-.+'
26+
- action: replace
27+
source_labels: [__address__, __meta_kubernetes_pod_annotation_promcat_sysdig_com_port]
28+
regex: ([^:]+)(?::\d+)?;(\d+)
29+
replacement: $1:$2
30+
target_label: __address__
31+
- action: replace
32+
source_labels: [__meta_kubernetes_pod_uid]
33+
target_label: sysdig_k8s_pod_uid
34+
- action: replace
35+
source_labels: [__meta_kubernetes_pod_container_name]
36+
target_label: sysdig_k8s_pod_container_name
737
dragent.yaml: |-
838
metrics_excess_log: true
939
k8s_cluster_name: YourClusterName

0 commit comments

Comments
 (0)