neuralfraud / grafana-prtg

A PRTG Datasource plugin for Grafana
181 stars 75 forks source link

PRTG's Trigger dashboard #199

Open gwendal-tlg opened 2 years ago

gwendal-tlg commented 2 years ago

Hello,

Thanks for your job.

Is it possible to see, how do you configure a dashboard just to see triggers ? Like pictures in your wiki. image

Per advance, thanks.

Kind regards.

alex0107 commented 1 year ago

Hi, a little bit late but I figured it out you have to use:

Query Mode: Raw URI: table.json Specific Query String:

content=sensors&columns=objid,downtimesince,device,sensor,lastvalue,status,message,priority&filter_status=5
AND
content=sensors&columns=objid,downtimesince,device,sensor,lastvalue,status,message,priority&filter_status=4

After this you have to transform the data for your table:

image

Than you can customize your table as you want:

image

Found here #51

//EDIT

image

Working JSON:

{
  "datasource": {
    "uid": "XXX",
    "type": "jasonlashua-prtg-datasource"
  },
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "auto",
        "cellOptions": {
          "type": "color-background",
          "mode": "gradient"
        },
        "inspect": false,
        "filterable": false
      },
      "mappings": [
        {
          "options": {
            "Fehler": {
              "color": "dark-red",
              "index": 1
            },
            "Warnung": {
              "color": "dark-yellow",
              "index": 0
            }
          },
          "type": "value"
        }
      ],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          }
        ]
      },
      "color": {
        "fixedColor": "transparent",
        "mode": "fixed"
      },
      "noValue": "-"
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "Sensor"
        },
        "properties": [
          {
            "id": "custom.width",
            "value": 168
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Status"
        },
        "properties": [
          {
            "id": "custom.width",
            "value": 138
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Downtime"
        },
        "properties": [
          {
            "id": "custom.width",
            "value": 214
          }
        ]
      },
      {
        "matcher": {
          "id": "byName",
          "options": "Last Value"
        },
        "properties": [
          {
            "id": "custom.width",
            "value": 192
          }
        ]
      }
    ]
  },
  "gridPos": {
    "h": 6,
    "w": 24,
    "x": 0,
    "y": 25
  },
  "id": 7,
  "options": {
    "showHeader": true,
    "cellHeight": "sm",
    "footer": {
      "show": false,
      "reducer": [
        "sum"
      ],
      "countRows": false,
      "fields": ""
    },
    "sortBy": [],
    "frameIndex": 1
  },
  "pluginVersion": "9.5.2",
  "targets": [
    {
      "datasource": {
        "type": "jasonlashua-prtg-datasource",
        "uid": "XX"
      },
      "channel": {
        "name": ""
      },
      "device": {
        "name": ""
      },
      "errors": {},
      "functions": [],
      "group": {
        "name": ""
      },
      "options": {
        "includeDeviceName": false,
        "includeSensorName": false,
        "mode": {
          "name": "Raw",
          "value": 3
        }
      },
      "raw": {
        "queryString": "content=sensors&columns=objid,downtimesince,device,sensor,lastvalue,status,message,priority&filter_status=5",
        "uri": "table.json"
      },
      "refId": "A",
      "sensor": {
        "name": ""
      },
      "hide": false
    },
    {
      "datasource": {
        "type": "jasonlashua-prtg-datasource",
        "uid": "XX"
      },
      "channel": {
        "name": ""
      },
      "device": {
        "name": ""
      },
      "errors": {},
      "functions": [],
      "group": {
        "name": ""
      },
      "options": {
        "includeDeviceName": false,
        "includeSensorName": false,
        "mode": {
          "name": "Raw",
          "value": 3
        }
      },
      "raw": {
        "queryString": "content=sensors&columns=objid,downtimesince,device,sensor,lastvalue,status,message,priority&filter_status=4",
        "uri": "table.json"
      },
      "refId": "B",
      "sensor": {
        "name": ""
      },
      "hide": false
    }
  ],
  "title": "Alarme",
  "transformations": [
    {
      "id": "joinByField",
      "options": {
        "byField": "blah",
        "mode": "outer"
      }
    },
    {
      "id": "extractFields",
      "options": {
        "format": "json",
        "jsonPaths": [
          {
            "alias": "Sensor",
            "path": "sensor"
          },
          {
            "alias": "Status",
            "path": "status"
          },
          {
            "alias": "Downtime",
            "path": "downtimesince"
          },
          {
            "alias": "Last Value",
            "path": "lastvalue"
          },
          {
            "alias": "Message",
            "path": "message_raw"
          }
        ],
        "keepTime": false,
        "replace": true,
        "source": "blah"
      }
    }
  ],
  "type": "table",
  "description": ""
}