MarcusCalidus / marcuscalidus-svg-panel

Grafana panel for displaying metric sensitive SVG images using the snap svg library
MIT License
62 stars 28 forks source link

Cannot get full data when querying for zabbix triggers #43

Closed nmoreaud closed 4 years ago

nmoreaud commented 4 years ago

I use Zabbix-connector to get monitoring data from Zabbix. When I query triggers (alarms) without count, I get a table result with additional informations.

However, I cannot access raw results in the svg plugin (ctr.data contains filtered data). Could you please add something like a "rawData" attribute ?

Here is the JSON result of the zabbix data source query (ajax) :

{
  "jsonrpc": "2.0",
  "result": [
    {
      "triggerid": "16632",
      "expression": "{19418}=1 and {19419}>0",
      "description": "System name has changed (new name: acb7abc30cb7)",
      "url": "",
      "status": "0",
      "value": "1",
      "priority": "1",
      "lastchange": "1574785369",
      "comments": "System name has changed. Ack to close.",
      "error": "",
      "templateid": "16615",
      "type": "0",
      "state": "0",
      "flags": "0",
      "recovery_mode": "2",
      "recovery_expression": "",
      "correlation_mode": "0",
      "correlation_tag": "",
      "manual_close": "1",
      "opdata": "",
      "groups": [
        {
          "groupid": "2",
          "name": "Linux servers",
          "internal": "0",
          "flags": "0"
        }
      ],
      "hosts": [
        {
          "hostid": "10305",
          "host": "zabbix-agent-1",
          "name": "zabbix-agent-1"
        }
      ],
      "lastEvent": {
        "eventid": "184",
        "source": "0",
        "object": "0",
        "objectid": "16632",
        "clock": "1574785369",
        "value": "1",
        "acknowledged": "0",
        "ns": "538615508",
        "name": "System name has changed (new name: acb7abc30cb7)",
        "severity": "1"
      }
    }
  ],
  "id": 1
}

Here is ctrl.data content :

[
  {
    "columnNames": [
      "Host group",
      "Disaster",
      "High",
      "Average",
      "Warning",
      "Information",
      "Not classified"
    ],
    "rows": [
      {
        "Host group": "Linux servers",
        "Disaster": 0,
        "High": 0,
        "Average": 0,
        "Warning": 0,
        "Information": 1,
        "Not classified": 0
      }
    ]
  }
]

If it helps I can provide you a DockerFile with Zabbix and Grafana configured.

nmoreaud commented 4 years ago

I added this, and saw that the data filtering is being done in zabbix connector, so I guess you can't do anything about it -_-

ctrl.events.on('data-received', function(data) { console.log(data); });

Just to be sure, do you know if I can get the datasource query options somewhere from JS ? That way I could make my own ajax request to get more data from zabbix.

MarcusCalidus commented 4 years ago

I'm not quite sure if it is possible to access the internals of the datasource. It might be possible though, that it is hidden somewhere in ctrl.datasource or ctrl.datasourceSrv.

nmoreaud commented 4 years ago

Thanks