Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix can not get license for emqx 4 #78

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- "*"

jobs:
release:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -41,6 +41,18 @@ jobs:
repository: "${{ github.repository }}"
readme-filepath: ./README.md
short-description: "Exporter for EMQX metrics."

release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.20.x
- name: Build
env:
VSN: ${{ github.ref_name }}
run: make build
- id: prerelease
run: |
if echo "${{ github.ref_name }}" |egrep -q "^[0-9].[0-9].[0-9]$"; then
Expand All @@ -56,3 +68,5 @@ jobs:
name: EMQX Exporter ${{ github.ref_name }} Released
body_path: RELEASE.md
generate_release_notes: true
files: |
emqx-exporter-**.tgz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ bin
__pycache__
env/

*.tgz
cover.*
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

VSN ?= $(shell git describe --tags --always)
OS ?= $(shell go env OS)

all: build

.PHONY: build
build:
go build -o $(LOCALBIN)/$(PROJECT_NAME)
GOOS=$(OS) go build -o $(LOCALBIN)/$(PROJECT_NAME)
@cp $(PROJECT_DIR)/config/example/config.yaml $(LOCALBIN)/config.yaml
@tar -zcvf emqx-exporter-$(OS)-$(VSN).tgz bin

.PHONY: test
test:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ scrape_configs:
# fix value, don't modify
from: exporter
- job_name: 'exporter-probe'
metrics_path: /probes
metrics_path: /probe
params:
target:
# must equal the `probes[$index].taget` in config file
Expand Down
7 changes: 1 addition & 6 deletions collector/client_4.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ import (
var _ emqxClientInterface = &client4x{}

type client4x struct {
edition edition
requester *requester
}

func (n *client4x) getLicense() (lic *LicenseInfo, err error) {
if n.edition == openSource {
return
}

resp := struct {
Data struct {
MaxConnections int64 `json:"max_connections"`
Expand Down Expand Up @@ -137,7 +132,7 @@ func (n *client4x) getRuleEngineMetrics() (metrics []RuleEngine, err error) {
}
Code int
}{}
err = n.requester.callHTTPGetWithResp("/api/v4/rules?_limit=10000", &resp)
err = n.requester.callHTTPGetWithResp("/api/v4/rules", &resp)
if err != nil {
return
}
Expand Down
4 changes: 1 addition & 3 deletions collector/client_5.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ func (n *client5x) getClusterStatus() (cluster ClusterStatus, err error) {
}
cluster.CPULoads[nodeName] = cpuLoad

if data.Edition == "Opensource" {
n.edition = openSource
} else {
if data.Edition == "Enterprise" {
n.edition = enterprise
}
}
Expand Down
10 changes: 6 additions & 4 deletions examples/docker-compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,30 @@ services:
image: emqx:5
container_name: emqx-demo
ports:
- 18084:18084
- 18083:18083
- 1883:1883
- 8083:8083
- 8084:8084
- 8883:8883
environment:
EMQX_API_KEY__BOOTSTRAP_FILE: '"/opt/emqx/data/bootstrap-api"'
EMQX_DASHBOARD__LISTENERS__HTTPS__BIND: 18084
volumes:
- ./bootstrap-api:/opt/emqx/data/bootstrap-api
healthcheck:
test: ["CMD", "emqx", "ctl", "status"]
test: ["CMD", "emqx", "ping"]
interval: 30s
timeout: 10s
retries: 3

emqx-exporter:
depends_on:
- emqx
image: emqx-exporter
image: emqx/emqx-exporter:0.2.3
container_name: exporter-demo
# ports:
# - 8085:8085
ports:
- 8085:8085
volumes:
- ./emqx-exporter.config.yaml:/usr/local/emqx-exporter/bin/config.yaml

Expand Down
20 changes: 19 additions & 1 deletion examples/docker-compose/emqx-exporter.config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
metrics:
target: emqx-demo:18083
api_key: some_api_key
api_secret: some_api_secret
target: emqx-demo:18084
scheme: https
tls_config:
insecure_skip_verify: true
probes:
- target: emqx-demo:1883
- target: emqx-demo:8883
scheme: tls
client_id: my_demo
username: my_demo
password: my_demo
topic: my_demo
qos: 1
tls_config:
insecure_skip_verify: true
- target: emqx-demo:8083/mqtt
scheme: ws
- target: emqx-demo:8084/mqtt
scheme: wss
tls_config:
insecure_skip_verify: true
39 changes: 39 additions & 0 deletions examples/docker-compose/prometheus-emqx5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,42 @@ scrape_configs:
cluster: test
# fix value, don't modify
from: probe
- job_name: 'mqtts-probe'
metrics_path: '/probe'
params:
target:
- "emqx-demo:8883"
scrape_interval: 5s
static_configs:
- targets: [exporter-demo:8085]
labels:
# label the cluster name of where the metrics data from
cluster: test
# fix value, don't modify
from: probe
- job_name: 'ws-probe'
metrics_path: '/probe'
params:
target:
- "emqx-demo:8083/mqtt"
scrape_interval: 5s
static_configs:
- targets: [exporter-demo:8085]
labels:
# label the cluster name of where the metrics data from
cluster: test
# fix value, don't modify
from: probe
- job_name: 'wss-probe'
metrics_path: '/probe'
params:
target:
- "emqx-demo:8084/mqtt"
scrape_interval: 5s
static_configs:
- targets: [exporter-demo:8085]
labels:
# label the cluster name of where the metrics data from
cluster: test
# fix value, don't modify
from: probe
Loading