Skip to content

Grafana Dashboard #636

@pohlm01

Description

@pohlm01

I started creating a Grafana Dashboard for the PTP metrics. Due to time limitations and as not all exported metrics are actually filled with values, the current status of that dashboard is still work-in-progress. Below is the current state as JSON export. It might be nice to publish (a further developed dashboard) to https://grafana.com/grafana/dashboards/

Dashboard JSON
{
  "__inputs": [
    {
      "name": "DS_GRAFANACLOUD-POHL-PROM",
      "label": "grafanacloud-pohl-prom",
      "description": "",
      "type": "datasource",
      "pluginId": "prometheus",
      "pluginName": "Prometheus"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "11.6.0-83314"
    },
    {
      "type": "datasource",
      "id": "prometheus",
      "name": "Prometheus",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "stat",
      "name": "Stat",
      "version": ""
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "description": "Displaying the most important metrics produced by [Statime](https://github.com/pendulum-project/statime)",
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "options": {
                "1": {
                  "index": 0,
                  "text": "Initializing"
                },
                "2": {
                  "index": 1,
                  "text": "Faulty"
                },
                "3": {
                  "index": 2,
                  "text": "Disabled"
                },
                "4": {
                  "index": 3,
                  "text": "Listening"
                },
                "5": {
                  "index": 4,
                  "text": "PreMaster"
                },
                "6": {
                  "index": 5,
                  "text": "Master"
                },
                "7": {
                  "index": 6,
                  "text": "Passive"
                },
                "8": {
                  "index": 7,
                  "text": "Uncalibrated"
                },
                "9": {
                  "index": 8,
                  "text": "Slave"
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 5,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "text": {},
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "11.6.0-83314",
      "targets": [
        {
          "disableTextWrap": false,
          "editorMode": "builder",
          "expr": "statime_port_state{clock_identity=~\"$clock_identiy\"}",
          "fullMetaSearch": false,
          "includeNullMetadata": true,
          "legendFormat": "{{clock_identity}}",
          "range": true,
          "refId": "A",
          "useBackend": false,
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
          }
        }
      ],
      "title": "Port state",
      "transformations": [
        {
          "id": "convertFieldType",
          "options": {
            "conversions": [
              {}
            ],
            "fields": {}
          }
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "text",
            "mode": "fixed"
          },
          "mappings": [
            {
              "options": {
                "6": {
                  "index": 0,
                  "text": "Primary, PTP (6)"
                },
                "7": {
                  "index": 1,
                  "text": "Holdover, PTP (7)"
                },
                "13": {
                  "index": 3,
                  "text": "Primary, ARB (13)"
                },
                "14": {
                  "index": 4,
                  "text": "Holdover, ARB (14)"
                },
                "52": {
                  "index": 6,
                  "text": "Degraded, A, PTP (52)"
                },
                "58": {
                  "index": 8,
                  "text": "Degraded, A, ARB (58)"
                },
                "187": {
                  "index": 10,
                  "text": "Degraded, B, PTP (187)"
                },
                "193": {
                  "index": 12,
                  "text": "Degraded, B, ARB (193)"
                },
                "248": {
                  "index": 14,
                  "text": "Default (248)"
                },
                "255": {
                  "index": 16,
                  "text": "Slave-only (255)"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "from": 8,
                "result": {
                  "index": 2,
                  "text": "Reserved"
                },
                "to": 12
              },
              "type": "range"
            },
            {
              "options": {
                "from": 15,
                "result": {
                  "index": 5,
                  "text": "Reserved"
                },
                "to": 51
              },
              "type": "range"
            },
            {
              "options": {
                "from": 53,
                "result": {
                  "index": 7,
                  "text": "Reserved"
                },
                "to": 57
              },
              "type": "range"
            },
            {
              "options": {
                "from": 59,
                "result": {
                  "index": 9,
                  "text": "Reserved"
                },
                "to": 186
              },
              "type": "range"
            },
            {
              "options": {
                "from": 188,
                "result": {
                  "index": 11,
                  "text": "Reserved"
                },
                "to": 192
              },
              "type": "range"
            },
            {
              "options": {
                "from": 194,
                "result": {
                  "index": 13,
                  "text": "Reserved"
                },
                "to": 247
              },
              "type": "range"
            },
            {
              "options": {
                "from": 249,
                "result": {
                  "index": 15,
                  "text": "Reserved"
                },
                "to": 254
              },
              "type": "range"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 1,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "value_and_name",
        "wideLayout": true
      },
      "pluginVersion": "11.6.0-83314",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
          },
          "disableTextWrap": false,
          "editorMode": "builder",
          "exemplar": false,
          "expr": "statime_grandmaster_clock_quality_class{clock_identity=~\"$clock_identiy\"}",
          "fullMetaSearch": false,
          "includeNullMetadata": true,
          "interval": "",
          "legendFormat": "{{clock_identity}}",
          "range": true,
          "refId": "A",
          "useBackend": false
        }
      ],
      "title": "Grandmaster clock quality class",
      "type": "stat"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "ns"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 8
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [
            "last",
            "median"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "hideZeros": false,
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "11.6.0-83314",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
          },
          "disableTextWrap": false,
          "editorMode": "builder",
          "exemplar": false,
          "expr": "statime_offset_from_master_nanoseconds{clock_identity=~\"$clock_identiy\"}",
          "fullMetaSearch": false,
          "includeNullMetadata": true,
          "interval": "",
          "legendFormat": "{{clock_identity}}",
          "range": true,
          "refId": "A",
          "useBackend": false
        }
      ],
      "title": "Offset from master",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "prometheus",
        "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "text",
            "mode": "fixed"
          },
          "mappings": [
            {
              "options": {
                "6": {
                  "index": 0,
                  "text": "Primary, PTP (6)"
                },
                "7": {
                  "index": 1,
                  "text": "Holdover, PTP (7)"
                },
                "13": {
                  "index": 3,
                  "text": "Primary, ARB (13)"
                },
                "14": {
                  "index": 4,
                  "text": "Holdover, ARB (14)"
                },
                "52": {
                  "index": 6,
                  "text": "Degraded, A, PTP (52)"
                },
                "58": {
                  "index": 8,
                  "text": "Degraded, A, ARB (58)"
                },
                "187": {
                  "index": 10,
                  "text": "Degraded, B, PTP (187)"
                },
                "193": {
                  "index": 12,
                  "text": "Degraded, B, ARB (193)"
                },
                "248": {
                  "index": 14,
                  "text": "Default (248)"
                },
                "255": {
                  "index": 16,
                  "text": "Slave-only (255)"
                }
              },
              "type": "value"
            },
            {
              "options": {
                "from": 8,
                "result": {
                  "index": 2,
                  "text": "Reserved"
                },
                "to": 12
              },
              "type": "range"
            },
            {
              "options": {
                "from": 15,
                "result": {
                  "index": 5,
                  "text": "Reserved"
                },
                "to": 51
              },
              "type": "range"
            },
            {
              "options": {
                "from": 53,
                "result": {
                  "index": 7,
                  "text": "Reserved"
                },
                "to": 57
              },
              "type": "range"
            },
            {
              "options": {
                "from": 59,
                "result": {
                  "index": 9,
                  "text": "Reserved"
                },
                "to": 186
              },
              "type": "range"
            },
            {
              "options": {
                "from": 188,
                "result": {
                  "index": 11,
                  "text": "Reserved"
                },
                "to": 192
              },
              "type": "range"
            },
            {
              "options": {
                "from": 194,
                "result": {
                  "index": 13,
                  "text": "Reserved"
                },
                "to": 247
              },
              "type": "range"
            },
            {
              "options": {
                "from": 249,
                "result": {
                  "index": 15,
                  "text": "Reserved"
                },
                "to": 254
              },
              "type": "range"
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              }
            ]
          }
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 8
      },
      "id": 6,
      "options": {
        "colorMode": "value",
        "graphMode": "area",
        "justifyMode": "auto",
        "orientation": "auto",
        "percentChangeColorMode": "standard",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showPercentChange": false,
        "textMode": "value_and_name",
        "wideLayout": true
      },
      "pluginVersion": "11.6.0-83314",
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "${DS_GRAFANACLOUD-POHL-PROM}"
          },
          "disableTextWrap": false,
          "editorMode": "builder",
          "exemplar": false,
          "expr": "statime_quality_class{clock_identity=~\"$clock_identiy\"}",
          "fullMetaSearch": false,
          "includeNullMetadata": true,
          "interval": "",
          "legendFormat": "{{clock_identity}}",
          "range": true,
          "refId": "A",
          "useBackend": false
        }
      ],
      "title": "Clock quality class",
      "type": "stat"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 41,
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "definition": "label_values(clock_identity)",
        "includeAll": true,
        "label": "Clock identity",
        "multi": true,
        "name": "clock_identiy",
        "options": [],
        "query": {
          "qryType": 1,
          "query": "label_values(clock_identity)",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "refresh": 1,
        "regex": "",
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-5m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "Statime",
  "uid": "aeef20bjfrbwgd",
  "version": 6,
  "weekStart": ""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions