-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add absent_over_time to expr * Add manual tests * fetch-lib --------- Co-authored-by: Luca Bello <36242061+lucabello@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
121 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Test NRPE | ||
### Deploy | ||
First deploy the [`nrpe-k8s-bundle`](nrpe-k8s-bundle.yaml) in a k8s model, and then deploy the | ||
[`nrpe-lxd-bundle`](nrpe-lxd-bundle.yaml) in a lxd model. | ||
|
||
```mermaid | ||
graph LR | ||
subgraph lxd | ||
ububntu --- nrpe --- cos-proxy | ||
end | ||
subgraph k8s | ||
prometheus | ||
end | ||
cos-proxy ---prometheus | ||
``` | ||
|
||
### Verify | ||
- Make sure rule files are available in prometheus: | ||
- relation data: `juju show-unit prom/0` | ||
- on disk: `juju ssh --container prometheus prom/0 ls /etc/prometheus/rules` | ||
- via http api: `curl x.x.x.x:9090/api/v1/rules | jq` | ||
- Stop the nrpe-exporter service, `juju ssh cp/0 sudo systemctl stop nrpe-exporter`, and make sure: | ||
- All nrpe related targets are down, `curl x.x.x.x:9090/api/v1/targets | jq` | ||
- 10 minutes after stopping, alerts are firing: | ||
`curl x.x.x.x:9090/api/v1/rules | jq '.data.groups | .[].rules | .[] | select(.state == "firing")'` | ||
- Start the nrpe exporter, `juju ssh cp/0 sudo systemctl start nrpe-exporter`, and make sure | ||
the alerts are not firing anymore (need to wait for the scrape interval, 1m, to elapse). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
bundle: kubernetes | ||
applications: | ||
prom: | ||
charm: prometheus-k8s | ||
channel: edge | ||
revision: 170 | ||
scale: 1 | ||
trust: true | ||
|
||
--- # overlay.yaml | ||
applications: | ||
prom: | ||
offers: | ||
prom: | ||
endpoints: | ||
- metrics-endpoint | ||
- receive-remote-write | ||
acl: | ||
admin: admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
series: jammy | ||
|
||
saas: | ||
prom: | ||
url: k8s:admin/cos.prom | ||
|
||
applications: | ||
cp: | ||
# charm path is relative to the bundle file | ||
charm: ../../cos-proxy_ubuntu-20.04-amd64_ubuntu-22.04-amd64.charm | ||
series: focal | ||
num_units: 1 | ||
nrpe: | ||
charm: nrpe | ||
channel: edge | ||
ub: | ||
charm: ubuntu | ||
channel: edge | ||
num_units: 1 | ||
|
||
relations: | ||
|
||
# NRPE forwards names of checks (e.g. "check_conntrack") over the monitors relation | ||
- - nrpe:monitors | ||
- cp:monitors | ||
|
||
# NRPE is a subordinate charm, so we use "ubuntu" as a stand-in principal | ||
- - ub:juju-info | ||
- nrpe:general-info | ||
|
||
# cos-proxy generated alert rules on-the-fly from the checks it got from the "monitors" relation. | ||
- - cp:downstream-prometheus-scrape | ||
- prom:metrics-endpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters