Grafana: Top N values: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
Zeile 9: Zeile 9:
 
   data_format = "json"
 
   data_format = "json"
 
   data_type = "float"
 
   data_type = "float"
   tag_keys = ["FileSystemLabel"]
+
   tag_keys = ["FileSystemLabel"] </pre>
</pre>
+
  
 
'''Measurement''' = cluster_csv <br>
 
'''Measurement''' = cluster_csv <br>

Version vom 6. Oktober 2020, 15:41 Uhr

Top N values single

Telegraf configuration

Because there is no Perfmon-Counter for the total size of Cluster Shared Volumes (CSV), I wrote a PowerShell CMDLET.

 [[inputs.exec]]
   commands = ['''powershell.exe -NoProfile -Command "Get-Volume | Where-Object {$_.FileSystem -eq 'CSVFS'} | select FileSystemLabel, AllocationUnitSize, Size, SizeRemaining, @{N='SizeUsed';E={$_.Size - $_.SizeRemaining}} | ConvertTo-Json"''']
   name_override = "cluster_csv"
   data_format = "json"
   data_type = "float"
   tag_keys = ["FileSystemLabel"] 

Measurement = cluster_csv
Tags = FileSystemLabel


InfluxQL in Grafana

Size = Total size of the CSV
SizeUsed = Used size of the CSV
FileSystemLabel = Is the name of the CSV

InfluxQL (Format as Table):

SELECT top("UsedSpace (%)","FileSystemLabel",$top) AS "UsedSpace (%)" FROM (
  SELECT (100 / mean("Size")) * mean("SizeUsed") AS "UsedSpace (%)"
  FROM "$rp"."cluster_csv" 
  WHERE $timeFilter 
  GROUP BY "FileSystemLabel"
) 

Grafana Panel settings:
FORMAT AS = Table
Visualization = Table
Overrides = Fields with name = "UsedSpace (%)" -> Unit = "Percent (0-100)", Decimals = 1, Cell Display mode = "Gradient gauge"





SELECT top("Average","host",$top) AS "Average" FROM (

 SELECT sum("Average") AS "Average" FROM (
   SELECT ((100 / (mean("Current_Bandwidth") / 8)) * (mean("Bytes_Sent_persec") + mean("Bytes_Received_persec"))) AS "Average"
   FROM "$rp"."win_net" 
   WHERE $timeFilter AND "host" =~ $hostfilter AND "instance" !~ /^Hyper-V.+/
   GROUP BY "host", "instance"
 ) GROUP BY "host"

)