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

Python json.tool module errors #3

Open
sfchrisgleason opened this issue Jun 8, 2018 · 0 comments
Open

Python json.tool module errors #3

sfchrisgleason opened this issue Jun 8, 2018 · 0 comments

Comments

@sfchrisgleason
Copy link

So I'm using centos 7 and sometimes python dumps a bunch of error output along with the value causing zabbix to turn the item unsupported due to a type mismatch.

I redirected stderr with 2>/dev/null on each line in the bash script and it started working fine for me as I was getting sporadic results in the graphs.

I'm also using Zabbix 3.0 (I know it's old, planning on upgrading) but I back ported your template to 3.0 if you want it.

#!/bin/bash

case $1 in
    status )
        initctl status logstash | grep -q running && echo 1 || echo 0 ;;
    heap_bytes )
        curl -s http://localhost:9600//_node/stats/jvm | python -mjson.tool 2>/dev/null | grep \"heap_used_in_bytes | awk '{ print $2 }' | sed 's/,//' ;;
    heap_percent )
        curl -s http://localhost:9600//_node/stats/jvm | python -mjson.tool 2>/dev/null | grep \"heap_used_percent | awk '{ print $2 }' | sed 's/,//' ;;
    heap_max )
        curl -s http://localhost:9600//_node/stats/jvm | python -mjson.tool 2>/dev/null | grep \"heap_max_in_bytes | awk '{ print $2 }' | sed 's/,//' ;;
    events_in )
        curl -s http://localhost:9600//_node/stats/pipeline | python -mjson.tool 2>/dev/null | head -10 | grep \"in | awk '{ print $2 }' | sed 's/,//' ;;
    events_filtered )
        curl -s http://localhost:9600//_node/stats/pipeline | python -mjson.tool 2>/dev/null | head -10 | grep \"filtered | awk '{ print $2 }' | sed 's/,//' ;;
    events_out )
        curl -s http://localhost:9600//_node/stats/pipeline | python -mjson.tool 2>/dev/null | head -11 | grep \"out | awk '{ print $2 }' | sed 's/,//' ;;
    failures )
        curl -s http://localhost:9600//_node/stats/pipeline | python -mjson.tool 2>/dev/null | grep \"failures | awk '{ print $2 }' | sed 's/,//' ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant