Skip to content

Commit 8468138

Browse files
authored
Merge pull request ceph#66326 from afreen23/fixes-mixins
monitoring: Fixes for development Reviewed-by: Nizamudeen A <[email protected]> Reviewed-by: Anthony D Atri <[email protected]>
2 parents 812196b + bdae7b3 commit 8468138

File tree

4 files changed

+79
-39
lines changed

4 files changed

+79
-39
lines changed

monitoring/ceph-mixin/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
vendor
2+
jb
3+
jsonnet-bundler

monitoring/ceph-mixin/Makefile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,48 @@
1+
# Main development workflow
12
all: fmt generate lint test
23

4+
# Format Jsonnet code automatically
35
fmt:
46
./lint-jsonnet.sh -i
57

8+
# Generate all dashboards and alerts
69
generate: dashboards_out
710
tox -ealerts-fix
811

12+
# Install Jsonnet dependencies
913
vendor: jsonnetfile.lock.json
1014
tox -ejsonnet-bundler-install
1115

16+
# Generate JSON dashboards from Jsonnet templates
1217
dashboards_out: vendor dashboards
1318
tox -ejsonnet-fix
1419

20+
# Run all linters (Jsonnet and alerts)
1521
lint:
1622
tox -ejsonnet-lint
1723
tox -ealerts-lint
1824

25+
# Run all tests (verifies generated files match templates)
1926
test: generate
2027
tox -ejsonnet-check
2128
tox -epromql-query-test
2229
tox -ealerts-test
30+
31+
# Alias for test
2332
check: test
2433

25-
.PHONY: all fmt generate lint test check
34+
# Show this help message
35+
help:
36+
@echo "Ceph Mixin Development Commands:"
37+
@echo ""
38+
@echo " all - Format, generate, lint, and test everything"
39+
@echo " fmt - Format Jsonnet code automatically"
40+
@echo " generate - Generate all dashboards and alerts"
41+
@echo " vendor - Install Jsonnet dependencies"
42+
@echo " lint - Run all linters (Jsonnet and alerts)"
43+
@echo " test - Run all tests (requires generated files)"
44+
@echo " check - Alias for test"
45+
@echo ""
46+
@echo "Quick start: 'make all' to run the complete workflow"
47+
48+
.PHONY: all fmt generate lint test check help

monitoring/ceph-mixin/README.md

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ You can use the Grafana dashboards and alerts with Jsonnet like any other
88
prometheus mixin. You can find more resources about mixins in general on
99
[monitoring.mixins.dev](https://monitoring.mixins.dev/).
1010

11+
-------
12+
1113
### Grafana dashboards for Ceph
1214
In `dashboards_out` you can find a collection of
1315
[Grafana](https://grafana.com/grafana) dashboards for Ceph Monitoring.
@@ -18,25 +20,20 @@ plugin](http://docs.ceph.com/en/latest/mgr/prometheus/) and the
1820
[node_exporter (0.17.0)](https://github.com/prometheus/node_exporter).
1921

2022

21-
##### Recommended versions:
22-
-grafana 8.3.5
23-
-grafana-piechart-panel 1.6.2
24-
-grafana-status-panel 1.0.11
25-
26-
#### Requirements
27-
28-
- [Status Panel](https://grafana.com/plugins/vonage-status-panel) installed on
29-
your Grafana instance
30-
- [Pie Chart Panel](https://grafana.com/grafana/plugins/grafana-piechart-panel/)
31-
installed on your Grafana instance
32-
33-
3423
### Prometheus alerts
3524
In `prometheus_alerts.libsonnet` you'll find a set of Prometheus
3625
alert rules that should provide a decent set of default alerts for a
3726
Ceph cluster. After building them with jsonnet put this file in place according to your Prometheus
3827
configuration (wherever the `rules` configuration stanza points).
3928

29+
30+
### SNMP
31+
Ceph provides a MIB (CEPH-PROMETHEUS-ALERT-MIB.txt) to support sending
32+
Prometheus alerts to an SNMP management platform. The translation from
33+
Prometheus alert to SNMP trap requires the Prometheus alert to contain an OID
34+
that maps to a definition within the MIB. When making changes to the Prometheus
35+
alert rules file, developers should include any necessary changes to the MIB.
36+
4037
### Multi-cluster support
4138
Ceph-mixin supports dashboards and alerts across multiple clusters.
4239
To enable this feature you need to configure the following in `config.libsonnnet`:
@@ -45,38 +42,56 @@ To enable this feature you need to configure the following in `config.libsonnnet
4542
showMultiCluster: true,
4643
clusterLabel: '<your cluster label>',
4744
```
45+
----------------
4846

49-
##### Recommended versions:
50-
-prometheus v2.33.4
47+
### Building from Jsonnet
5148

52-
#### SNMP
53-
Ceph provides a MIB (CEPH-PROMETHEUS-ALERT-MIB.txt) to support sending
54-
Prometheus alerts to an SNMP management platform. The translation from
55-
Prometheus alert to SNMP trap requires the Prometheus alert to contain an OID
56-
that maps to a definition within the MIB. When making changes to the Prometheus
57-
alert rules file, developers should include any necessary changes to the MIB.
49+
#### Method 1: System Packages (Recommended for most users)
5850

51+
```bash
52+
sudo dnf install jsonnet jsonnet-bundler # RHEL/Fedora
53+
sudo apt-get install jsonnet jsonnet-bundler # Ubuntu/Debian
5954

60-
##### Recommended:
61-
-alertmanager 0.16.2
55+
# Install dependencies
56+
jb install
6257

63-
### Building from Jsonnet
58+
# Generate all dashboards and alerts
59+
make generate
60+
61+
# Run tests
62+
make test
63+
```
6464

65-
- Install [jsonnet](https://jsonnet.org/) (at least v0.18.0)
66-
- By installing the package `jsonnet` in most of the distro and
67-
`golang-github-google-jsonnet` in fedora
68-
- Install [jsonnet-bundler](https://github.com/jsonnet-bundler/jsonnet-bundler)
65+
#### Method 2: Local Build (For CI/CD or no root access)
6966

70-
To rebuild all the generated files, you can run `tox -egrafonnet-fix`.
67+
```bash
68+
./jsonnet-bundler-build.sh
7169

72-
The jsonnet code located in this directory depends on some Jsonnet third party
73-
libraries. To update those libraries you can run `jb update` and then update
74-
the generated files using `tox -egrafonnet-fix`.
70+
# Install dependencies using local jb
71+
./jb install
7572

76-
### Building alerts from `prometheus_alerts.libsonnet`
73+
# Generate all dashboards and alerts
74+
make generate
7775

78-
To rebuild the `prometheus_alerts.yml` file from the corresponding libsonnet,
79-
you can run `tox -ealerts-fix`.
76+
# Run tests
77+
make test
78+
```
79+
80+
### Ceph Mixin Development Commands
8081

82+
```bash
83+
make all # Format, generate, lint, and test
84+
make fmt # Format Jsonnet files
85+
make generate # Regenerate JSON dashboards and alerts from templates
86+
make lint # Run linters
87+
make test # Run all tests
88+
make vendor # Install dependencies
89+
make help # List all available commands
90+
```
8191

82-
##### Any upgrade or downgrade to different major versions of the recommended tools mentioned above is not supported.
92+
### Supported Versions
93+
* jsonnet: v0.18.0+
94+
* jsonnet-builder: 0.4.0+
95+
* grafonnet-lib: always uses latest `master` branch
96+
* alertmanager: 0.16.2+
97+
* prometheus: v2.33.4+

monitoring/ceph-mixin/tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ description =
5656
test: Run promtool unit testing on grafana queries.
5757
deps =
5858
-rrequirements-lint.txt
59-
depends = grafonnet-check
59+
depends = jsonnet-check
6060
setenv =
6161
allowlist_externals =
6262
promtool
@@ -67,7 +67,7 @@ commands =
6767
deps =
6868
-rrequirements-alerts.txt
6969
pytest
70-
depends = grafonnet-check
70+
depends = jsonnet-check
7171
allowlist_externals =
7272
promtool
7373
jsonnet

0 commit comments

Comments
 (0)