folder restructure, dbmanager placeholder, iniparser file fullpath, and updated example
This commit is contained in:
parent
3eb91d5352
commit
e89a2a75a8
8 changed files with 0 additions and 0 deletions
36
Legacy/san.py
Normal file
36
Legacy/san.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
import platform
|
||||
import psutil
|
||||
from datetime import datetime, timezone
|
||||
from influxdb import InfluxDBClient
|
||||
|
||||
mount_points = ['/mnt/raid6-a', '/mnt/raid6-b']
|
||||
|
||||
# Do not edit below this line #
|
||||
influx_payload = []
|
||||
devices = {
|
||||
'mount_points': {}
|
||||
}
|
||||
|
||||
for mount in mount_points:
|
||||
devices['mount_points'][mount] = {
|
||||
'usage': psutil.disk_usage(mount)
|
||||
}
|
||||
influx_payload.append(
|
||||
{
|
||||
"measurement": "Storage Servers",
|
||||
"tags": {
|
||||
"server": platform.uname()[1],
|
||||
"mount_point": mount
|
||||
},
|
||||
"time": datetime.now(timezone.utc).astimezone().isoformat(),
|
||||
"fields": {
|
||||
"bytes Used": devices['mount_points'][mount]['usage'].used,
|
||||
"bytes Free": devices['mount_points'][mount]['usage'].free,
|
||||
"bytes Total": devices['mount_points'][mount]['usage'].total,
|
||||
"Utilization": devices['mount_points'][mount]['usage'].percent
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
influx = InfluxDBClient('grafana.domain.tld', 8086, 'root', 'root', 'storage_server')
|
||||
influx.write_points(influx_payload)
|
Loading…
Add table
Add a link
Reference in a new issue