Skip to content

Commit efc342e

Browse files
committed
Refactor advanced notes2
1 parent 02fd5b9 commit efc342e

File tree

3 files changed

+133
-1
lines changed

3 files changed

+133
-1
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Alerts Customization
2+
3+
You can further setup and customize alerts in the stack.
4+
5+
## Customize Alert Contact points
6+
If you want alerts to go to a different contact, for example an Email address instead of slack, you can customize where alerts are sent by defining a new contact point in Grafana:
7+
8+
```
9+
notifiers:
10+
- name: "custom-contact"
11+
type: "slack"
12+
settings:
13+
url: "https://hooks.slack.com/services/..."
14+
```
15+
16+
Mount this file into:
17+
18+
```
19+
/etc/grafana/provisioning/alerting/custom-contact.yml
20+
```
21+
22+
Then update the environment variable:
23+
24+
```
25+
ALERTING_DEFAULT_CONTACT=custom-contact
26+
```
27+
28+
**Note** to be only mount the exact file, and not override the whole provisioning folder in the image, as this is already used to contain the defaults.
29+
30+
---
31+
32+
## Add Custom Alerts
33+
You can make custom alerts.
34+
35+
To define additional alert rules, create files in:
36+
37+
```
38+
/etc/grafana/provisioning/alerting/
39+
```
40+
41+
Grafana will automatically load these at startup.
42+
43+
---
44+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Prober Customizations
2+
3+
## How to add Auth to the prober or further configurations?
4+
5+
To define how a probe behaves (e.g., add basic auth, headers, timeout, method), we will configure a module in the Blackbox Exporter config.
6+
7+
#### Create a Blackbox Exporter Config file
8+
You will need to create a new file, and then mount it over the existing provided vconfig
9+
10+
11+
1. Create a new file:
12+
13+
```
14+
prometheus/blackbox-exporter/custom-blackbox-config.yml
15+
```
16+
17+
2. Add the existing defaults
18+
19+
```
20+
modules:
21+
http_get_200:
22+
prober: http
23+
timeout: 5s
24+
http:
25+
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
26+
valid_status_codes: [200] # Defaults to 2xx
27+
method: GET
28+
preferred_ip_protocol: "ip4" # defaults to "ip6"
29+
tls_config:
30+
insecure_skip_verify: true
31+
```
32+
33+
3. Add your own module to the modules in that file
34+
```
35+
http_2xx_custom:
36+
prober: http
37+
timeout: 5s
38+
http:
39+
valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
40+
valid_status_codes: [200] # Defaults to 2xx
41+
method: GET
42+
preferred_ip_protocol: "ip4" # defaults to "ip6"
43+
tls_config:
44+
insecure_skip_verify: true
45+
basic_auth:
46+
username: my-user
47+
password: example-pass
48+
```
49+
50+
This example adds a module named `http_2xx_custom` that adds some basic auth credentials
51+
52+
---
53+
54+
#### Reference the new module in your prober config
55+
56+
In your probe YAML file, reference the module in the `module` field of the `labels` section:
57+
58+
```
59+
- targets:
60+
- https://myservice.example.com/health
61+
labels:
62+
name: my-service
63+
module: http_2xx_custom # Optional - overrides the default Blackbox module
64+
```
65+
66+
#### Mount the config file
67+
You lastly need to mount the new config file and refer to it in docker compose
68+
69+
```
70+
blackbox-exporter:
71+
image: cogstacksystems/cogstack-observability-blackbox-exporter:latest
72+
restart: unless-stopped
73+
networks:
74+
- observability
75+
volumes:
76+
- ./prometheus/blackbox-exporter:/config
77+
command:
78+
- "--config.file=/config/custom-blackbox-config.yml"
79+
```
80+
81+
---

docs/observability/setup/production-setup.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ This will launch Prometheus, Grafana, and all required services with
6262

6363

6464
## Step 4: Create Site-Specific Config Files
65-
6665
You must provide your own scrape and recording rules to tell Prometheus what to monitor.
66+
67+
This is probably the hardest step: You will actually need to know what is running, and where it is! Building out these config files will give you that inventory, and give a real definition of what is running where.
68+
6769
- Probers: HTTP endpoints you want to monitor for availability
6870
- Add files in `scrape-configs/probers/*.yml`
6971
- [Configure Probers](./probing.md)
@@ -76,6 +78,9 @@ You must provide your own scrape and recording rules to tell Prometheus what to
7678
- Add files in `recording-rules/*.yml`
7779
- [Enable Alerting](./alerting.md)
7880

81+
## Step 5: Run Exporters Everywhere
82+
The exporters need to be run on each VM that you want information from. It's a pull model, not push.
83+
7984

8085
---
8186

@@ -87,5 +92,7 @@ You can now setup prometheus with any telemetry or probers required following th
8792

8893
For the last steps, you can
8994

95+
- Run the exporters on all the VMs that you want access to
96+
- Deploy the stack in produciton
9097
- Fully customise with [Customization](../customization/_index.md)
9198
- Look further into understanding the concepts and details in [Reference](../reference/_index.md)

0 commit comments

Comments
 (0)