Customize Grafana table

Hello there,

I have different tables which shows different stats like number of CPU cores, Total memory etc in the following format.

CPU Table :

server1 2
server2 4
server3 5

Memory Table:

server1 2G
server2 2G
server3 4G

likewise I have many tables for different stats for all my servers in different tables.

I would like to know if there is a way around to merge these tables so that I can get it in the below format:

server name : CPU Cores: Memory :
server1 2 2G
server2 4 2G
server3 5 4G

The different stats for the same server need to be shown as different columns in the same table. This will really help me to import the data as a single csv file and create excel reports easily.

Thanks much for your help in advance.

Cheers,
Tuxworm.

Hello there,

I have different tables which shows different stats like number of CPU cores, Total memory etc in the following format.

likewise I have many tables for different stats for all my servers in different tables.

I would like to know if there is a way around to merge these tables so that I can get it in the below format:

(created using excel for demo purpose)

The different stats for the same server need to be shown as different columns in single same table. This will really help me to import the data as a single csv file and create excel reports easily.

Cheers
Tuxworm

Greetings,

@tuxworm, After doing some research, I found the solution.

You should use simple-json data source, SimpleJson plugin for Grafana | Grafana Labs.
Then you can prepare you own json response by following the guide of simple-json datasource.

Here is an exmaple which developed in django.

Greg Gu

And how to make a similar table, if I have a data source is Zabbix server?

Greetings,

You have to fire multiple requests to zabbix server by using zabbix clients (e.g., pyzabbix in python).
Then make sure you api returns following data.

    data = [
        {
            "columns": [
                {"text": "time", "type": "time"},
                {"text": "server", "type": "string"},
                {"text": "cpu load avg1", "type": "number"},
                {"text": "cpu idle", "type": "number"},
                {"text": "cpu num", "type": "number"},
                {"text": "cpu mhz", "type": "number"},
                {"text": "memory used in percentage", "type": "number"},
                {"text": "disk io await avg", "type": "number"},
                {"text": "disk io util(%) avg", "type": "number"},
                {"text": "incoming traffic bytes on bond0", "type": "number"},
                {"text": "outgoing traffic bytes on bond0", "type": "number"},
            ],
            "rows": [],
            "type":"table"
        }
    ]

I added a “SimpleJson” plugin to Grafana. Now I need to add DataSource, as I understood. In the Datasource settings, I write in HTTP SETTINGS Url: http: //IP_ZABBIX_SERVER/zabbix/api_jsonrpc.php.
Am I doing the right thing?

No, you have to add your own backend url which provides the data.

> Your backend needs to implement 4 urls:
>
> / should return 200 ok. Used for “Test connection” on the datasource config page.
> /search used by the find metric options on the query tab in panels.
> /query should return metrics based on input.
> /annotations should return annotations.

图片

Do you have a example for creating URL’s? How should I create this with apache? Doesn’t the URL’s created reach a page and the page should have some code?