Skip to content

Commit

Permalink
Rename mixin, add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sysadmind committed Jul 14, 2024
1 parent c8bfd23 commit a990b9f
Show file tree
Hide file tree
Showing 22 changed files with 622 additions and 4 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/mixin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: mixin
on:
pull_request:
paths:
- "elasticsearch-mixin/**"

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.5
- name: Install dependencies
run: |
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
- name: Lint
run: bash ./scripts/lint-jsonnet.sh
19 changes: 18 additions & 1 deletion elasticsearch_mixin/README.md → elasticsearch-mixin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,33 @@ This is a mixin for the elasticsearch_exporter to define dashboards, alerts, and
Good example of upstream mixin for reference: https://github.com/kubernetes-monitoring/kubernetes-mixin


docker-compose
- docker-compose exec elasticsearch bash
- bin/elasticsearch-reset-password -u elastic -f
- login to grafana
- add prometheus datasource (http://prometheus:9090)
- http://127.0.0.1:3000
- http://127.0.0.1:9090/targets?search=
- http://127.0.0.1:9114/metrics

## Development

### JSONNET
https://jsonnet.org/

```go install github.com/google/go-jsonnet/cmd/jsonnet@latest```

### JSONNET BUNDLER
jsonnet bundler is a package manager for jsonnet

```go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest```
https://github.com/jsonnet-bundler/jsonnet-bundler

```go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest```

### Grafonnet
Grafana libraries for jsonnet: https://grafana.github.io/grafonnet/

```jb install github.com/grafana/grafonnet/gen/grafonnet-latest@main```

validate
go install github.com/grafana/dashboard-linter@latest
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
local dashboards = (import 'mixin.libsonnet').grafanaDashboards;

{ [name]: dashboards[name] for name in std.objectFields(dashboards)}
{ [name]: dashboards[name] for name in std.objectFields(dashboards) }
1 change: 1 addition & 0 deletions elasticsearch-mixin/dashboards/g.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'github.com/grafana/grafonnet/gen/grafonnet-latest/main.libsonnet'
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ local var = g.dashboard.variable;
+ var.query.queryTypes.withLabelValues(
'cluster',
'elasticsearch_cluster_health_status',
)
),
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a990b9f

Please sign in to comment.