Ad Widget

Collapse

How to avoid to send a single numeric value with input file option zabbix sender

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • magneking
    Junior Member
    • Jun 2020
    • 3

    #1

    How to avoid to send a single numeric value with input file option zabbix sender

    Hello,

    I am using zabbix sender with input file option. I need [average] value instead of [all] value because as I have read in the trapper documentation
    "Note that if a single numeric value is sent in, the data graph will show a horizontal line to the left and to the right of the time point of the value."
    I have a python script that returned a lot of values, these values ​​vary all the time but zabbix trapper only capture last value and zabbix frontend paints horizontal line.

    If I run the script in Linux machine with my_script.py | /usr/bin/zabbix_sender -r -z 127.0.0.1 -s mongodb -i - 2>&1, it returns success processed data.

    I need the real time values in the graph, What can i do?

    Thanks in advance.



  • magneking
    Junior Member
    • Jun 2020
    • 3

    #2
    Good Morning

    Could anybody help me please?
    If you need more information you can tell me

    Thanks a lot
    Regards

    Comment

    • aspzabbix
      Junior Member
      • Jun 2020
      • 15

      #3
      What is the value that you are getting from the front end latest data for the zabbix trapper item? Is it same as data that you are sending?

      Comment

      • magneking
        Junior Member
        • Jun 2020
        • 3

        #4
        Hello aspzabbix,

        I have a conf file with
        UserParameter=<key_that_is_calling_zabbix_sender>, <shell_script_path>

        The shell_script is calling to python script that returns all values that i need to monitor. This is more or less shell script:

        get_metrics(){
        python3.7 <python_script_path>
        }
        result=$(get_metrics | /usr/bin/zabbix_sender -z 127.0.0.1 -s <host_name> -i - 2>&1)
        response=$(echo "$result" | awk -F ';' '$1 ~ /^info/ && match($1,/[0-9].*$/) {sum+=substr($1,RSTART,RLENGTH)} END {print sum}')
        if [ -n "$response" ]; then
        echo "$response"
        else
        echo "$result"
        fi

        Today i noticed than in all Zabbix graphics from this monitoring were with no data, I have run shell script and Zabbix have get the data and the data in Zabbix is the same that it returns python script but Zabbix only paint the las value in one line at all time like I have read in zabbix trapper documentation
        "Note that if a single numeric value is sent in, the data graph will show a horizontal line to the left and to the right of the time point of the value."

        Thanks a lot

        Comment

        Working...