Giter Club home page Giter Club logo

zabbix-emqtt's People

Contributors

viniciusbo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zabbix-emqtt's Issues

Don't works with the current v3 api

Hello, I'm trying to fix this to work with current API v3. https://github.com/elcreator/zabbix-emqtt/blob/master/externalscripts/emqtt.sh

Currently it correctly parses the values from the first (and single one for me) node in the cluster.

Problem that I have is when I launch this even manually from the command line

$ zabbix_sender -z 127.0.0.1 -s 127.0.0.1 -k 'emqtt[messages/retained]' -o 3
Response from "127.0.0.1:10051": "processed: 0; failed: 1; total: 1; seconds spent: 0.000018"
sent: 1; skipped: 0; total: 1

it don't works. Trappers was configured and exists, host is reachable and allowed.

Cannot index array with string "result".

jq: error (at :1): Cannot index array with string "result"
what is the reason for this?

My MQTT version is 3.0
My configuration:
stats=$(curl --basic -u "$2:$3" -k -s "http://$4:18083/api/v3/stats/")
metrics=$(curl --basic -u "$2:$3" -k -s "http://$4:18083/api/v3/metrics/")

for key in "${STATS_KEYS[@]}"
do
out="$(jq -r --arg arg "$(printf '%s' $key)" '.result[]|.["emq@'"$1"'"]? | .[$arg]' <<< $stats)"

printf "%s %s\n" $key $out

zabbix_sender -z 127.0.0.1 -s $1 -k "emqtt[$key]" -o $out > /dev/null 2>&1
done

for key in "${METRICS_KEYS[@]}"
do
out="$(jq -r --arg arg "$(printf '%s' $key)" '.result[]|.["emq@'"$1"'"]? | .[$arg]' <<< $metrics)"

printf "%s %s\n" $key $out

zabbix_sender -z 127.0.0.1 -s $1 -k "emqtt[$key]" -o $out > /dev/null 2>&1
done

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.