bundles/pacman: add lm_sensors to telegraf, add dashboard row

This commit is contained in:
Franzi 2021-05-19 18:46:22 +02:00
parent c74a249a00
commit 3b3bdeecab
Signed by: kunsi
GPG key ID: 12E3D2136B818350
4 changed files with 245 additions and 2 deletions

View file

@ -0,0 +1,226 @@
def dashboard_row_sensors(panel_id, node):
return {
'title': 'sensors',
'collapse': False,
'editable': False,
'height': '200px',
'panels': [
{
'aliasColors': {},
'bars': False,
'dashLength': 10,
'dashes': False,
'datasource': None,
'fieldConfig': {
'defaults': {
'displayName': '${__field.labels.feature}'
},
'overrides': []
},
'fill': 1,
'fillGradient': 0,
'hiddenSeries': False,
'id': next(panel_id),
'legend': {
'alignAsTable': False,
'avg': False,
'current': False,
'max': False,
'min': False,
'rightSide': False,
'show': True,
'total': False,
'values': False
},
'lines': True,
'linewidth': 1,
'NonePointMode': 'None',
'options': {
'alertThreshold': True
},
'percentage': False,
'pluginVersion': '7.5.5',
'pointradius': 2,
'points': False,
'renderer': 'flot',
'seriesOverrides': [],
'spaceLength': 10,
'span': 8,
'stack': False,
'steppedLine': False,
'targets': [
{
'groupBy': [
{'type': 'time', 'params': ['$__interval']},
{'type': 'fill', 'params': ['linear']},
],
'orderByTime': "ASC",
'policy': "default",
'query': f"""from(bucket: "telegraf")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r["_measurement"] == "sensors" and
r["chip"] == "coretemp-isa-0000" and
r["_field"] == "temp_input" and
r["host"] == "{node.name}"
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> derivative(unit: 1s)
|> yield(name: "in")""",
'resultFormat': 'time_series',
'select': [[
{'type': 'field', 'params': ['value']},
{'type': 'mean', 'params': []},
]],
"tags": []
},
],
'thresholds': [],
'timeRegions': [],
'title': 'CPU Temperature',
'tooltip': {
'shared': True,
'sort': 0,
'value_type': 'individual'
},
'type': 'graph',
'xaxis': {
'buckets': None,
'mode': 'time',
'name': None,
'show': True,
'values': []
},
'yaxes': [
{
'format': 'celsius',
'label': None,
'logBase': 1,
'max': None,
'min': 0,
'show': True,
},
{
'format': 'short',
'label': None,
'logBase': 1,
'max': None,
'min': None,
'show': False,
}
],
'yaxis': {
'align': False,
'alignLevel': None
}
},
{
'aliasColors': {},
'bars': False,
'dashLength': 10,
'dashes': False,
'datasource': None,
'fieldConfig': {
'defaults': {
'displayName': '${__field.labels.feature}'
},
'overrides': []
},
'fill': 1,
'fillGradient': 0,
'hiddenSeries': False,
'id': next(panel_id),
'legend': {
'alignAsTable': False,
'avg': False,
'current': False,
'max': False,
'min': False,
'rightSide': False,
'show': True,
'total': False,
'values': False
},
'lines': True,
'linewidth': 1,
'NonePointMode': 'None',
'options': {
'alertThreshold': True
},
'percentage': False,
'pluginVersion': '7.5.5',
'pointradius': 2,
'points': False,
'renderer': 'flot',
'seriesOverrides': [],
'spaceLength': 10,
'span': 4,
'stack': False,
'steppedLine': False,
'targets': [
{
'groupBy': [
{'type': 'time', 'params': ['$__interval']},
{'type': 'fill', 'params': ['linear']},
],
'orderByTime': "ASC",
'policy': "default",
'query': f"""from(bucket: "telegraf")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) =>
r["_measurement"] == "sensors" and
r["_field"] == "fan_input" and
r["host"] == "{node.name}"
)
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> derivative(unit: 1s)
|> yield(name: "in")""",
'resultFormat': 'time_series',
'select': [[
{'type': 'field', 'params': ['value']},
{'type': 'mean', 'params': []},
]],
"tags": []
},
],
'thresholds': [],
'timeRegions': [],
'title': 'Fan speed',
'tooltip': {
'shared': True,
'sort': 0,
'value_type': 'individual'
},
'type': 'graph',
'xaxis': {
'buckets': None,
'mode': 'time',
'name': None,
'show': True,
'values': []
},
'yaxes': [
{
'format': 'rotrpm',
'label': None,
'logBase': 1,
'max': None,
'min': 0,
'show': True,
},
{
'format': 'short',
'label': None,
'logBase': 1,
'max': None,
'min': None,
'show': False,
}
],
'yaxis': {
'align': False,
'alignLevel': None
}
},
],
}

View file

@ -98,11 +98,16 @@ for rnode in repo.nodes:
dashboard_row_cpu(panel_id, rnode), dashboard_row_cpu(panel_id, rnode),
dashboard_row_ip_traffic(panel_id, rnode), dashboard_row_ip_traffic(panel_id, rnode),
dashboard_row_memory(panel_id, rnode), dashboard_row_memory(panel_id, rnode),
dashboard_row_disk_space(panel_id, rnode),
dashboard_row_disk_iops(panel_id, rnode),
], ],
} }
if rnode.has_bundle('pacman'):
dashboard['rows'].append(dashboard_row_sensors(panel_id, rnode))
dashboard['tags'].add('lm_sensors')
dashboard['rows'].append(dashboard_row_disk_space(panel_id, rnode))
dashboard['rows'].append(dashboard_row_disk_iops(panel_id, rnode))
if rnode.has_bundle('nginx'): if rnode.has_bundle('nginx'):
dashboard['rows'].append(dashboard_row_nginx(panel_id, rnode)) dashboard['rows'].append(dashboard_row_nginx(panel_id, rnode))
dashboard['tags'].add('nginx') dashboard['tags'].add('nginx')

View file

@ -16,6 +16,7 @@ pkg_pacman = {
'vim': {}, 'vim': {},
'wpa_supplicant': {}, 'wpa_supplicant': {},
'wpa_actiond': {}, 'wpa_actiond': {},
'lm_sensors': {},
} }
for pkg, config in node.metadata.get('pacman/packages', {}).items(): for pkg, config in node.metadata.get('pacman/packages', {}).items():

View file

@ -0,0 +1,11 @@
defaults = {
'telegraf': {
'input_plugins': {
'builtin': {
'sensors': [{
'timeout': '2s',
}],
},
},
},
}