Ad Widget

Collapse

monitoring bandwidth from zabbix using vnstat giving error Unknown metric

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • islam
    Junior Member
    • Apr 2024
    • 19

    #1

    monitoring bandwidth from zabbix using vnstat giving error Unknown metric

    Hello,
    I am trying to monitor my vps bandwidth using vnstat but I setup it and import template and link it but the latest data showing error Unknown metric system.currenthour
    please check the attachment
    Attached Files
  • islam
    Junior Member
    • Apr 2024
    • 19

    #2
    update please check attachment
    Attached Files

    Comment

    • islam
      Junior Member
      • Apr 2024
      • 19

      #3
      this is example of the shell script that that extract the values for zabbix from vnstat and calc the total_outbound_for_current_hour.sh
      Code:
      tempout1=$(vnstat -h| tail -n 2| awk -F\  '{ print $11}'| tail -n 1| awk -F\, '{ print $1}')
      tempout2=$(vnstat -h| tail -n 2| awk -F\  '{ print $11}'| tail -n 1| awk -F\, '{ print $2}')
      o=$tempout1$tempout2
      bandwidth_out_unit=$(vnstat -h| tail -n 9| awk -F\) '{ print $6}'| head -n 1|awk -F\( '{ print $2}')
      #echo $bandwidth_out_unit
      case "$bandwidth_out_unit" in
      KiB)    bandwidth_out_number_Byte=$(echo "$o*1024"| bc)
      ;;
      MiB)    bandwidth_out_number_Byte=$(echo "$o*1024*1024"|bc)
      ;;
      GiB)    bandwidth_out_number_Byte=$(echo "$o*1024*1024*1024"|bc)
      ;;
      TiB)    bandwidth_out_number_Byte=$(echo "$o*1024*1024*1024*1024"|bc)
      ;;
      esac
      #echo $bandwidth_out_number_Byte
      
      echo $bandwidth_out_number_Byte

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        First about unknown parameter... Have you defined your userparameters for this "system.currenthour" parameter?
        Second one suggests, that you do not get numeric (float) values from agent but string...
        I'm not familiar with vnstat output... What this line should do "o=$tempout1$tempout2" Concatenate 2 strings? numbers? And then you calculate something based on that? Maybe you do get error message as a result ...

        Comment

        • islam
          Junior Member
          • Apr 2024
          • 19

          #5
          I just downgrade the version and result is showing fine thank u

          Comment

          Working...