Ad Widget

Collapse

Extracting bandwidth value from database?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Steveo
    Member
    • Jun 2013
    • 31

    #1

    Extracting bandwidth value from database?

    It is possible to extract bandwidth values from the Zabbix database? For example, if I wanted to know the peak value for a month for a particular host/interface or itemid, could I query the database to get that fairly easily or is there an API we could call to get this? We have a fairly large setup (1000+ hosts, 46390+ items, 8760+ triggers) and currently have all numeric history/trends set at 7/365 and non-numeric set at 30/365.

    Thanks!
    Steve
  • mbsit
    Senior Member
    • Sep 2012
    • 130

    #2
    Yes, use the "Calculated item" and the function: max (min, avg etc.)

    Bests,
    Grzegorz

    --
    Wdrożenia Zabbix - Warszawa
    Pozdrawiam
    Grzegorz Grabowski
    ____
    WdroĊĵenia, szkolenia, umowy serwisowe
    Warszawa - Polska

    Comment

    • Steveo
      Member
      • Jun 2013
      • 31

      #3
      Originally posted by mbsit
      Yes, use the "Calculated item" and the function: max (min, avg etc.)

      Bests,
      Grzegorz

      --
      Wdrożenia Zabbix - Warszawa
      www.mbs-it.pl
      Thanks, but I was looking for a a command line solution. I'm using the item.get API call and SQL queries for min/max/avg daily to pull the 3 values.

      Below is my code if anyone is interested.

      Code:
      #!/bin/bash
      curl -i -X POST -H 'Content-Type: application/json' -d '{
           "jsonrpc":"2.0",
           "method":"item.get",
           "params":{
           "output":"extend",
           "hostids":"xxxxx",
              "search": {
              "key_": "ifHCInOctets"
              },
           "sortfield": "name"
        },
           "auth":"1ab0f240b33cc599d9a900fe37bbd4c0",
           "id":1
      }' http://127.0.0.1/zabbix/api_jsonrpc.php

      Code:
      select min(value) from history_uint where itemid = xxxxx and clock between UNIX_TIMESTAMP('2013-08-01 00:00:00') and UNIX_TIMESTAMP('2013-08-09 00:00:00');
      Code:
      select max(value) from history_uint where itemid = xxxxx and clock between UNIX_TIMESTAMP('2013-08-01 00:00:00') and UNIX_TIMESTAMP('2013-08-09 00:00:00');
      Code:
      select max(value) from history_uint where itemid = xxxxx and clock between UNIX_TIMESTAMP('2013-08-01 00:00:00') and UNIX_TIMESTAMP('2013-08-09 00:00:00');
      Thanks,
      Steve

      Comment

      Working...