Deleted out of scope scripts. Closes #41
This commit is contained in:
parent
1dcb0ad724
commit
896ec10247
3 changed files with 0 additions and 105 deletions
|
@ -1,34 +0,0 @@
|
||||||
# Do not edit this script. Edit configuration.py
|
|
||||||
import requests
|
|
||||||
from datetime import datetime, timezone
|
|
||||||
from influxdb import InfluxDBClient
|
|
||||||
|
|
||||||
from Legacy import configuration
|
|
||||||
|
|
||||||
current_time = datetime.now(timezone.utc).astimezone().isoformat()
|
|
||||||
|
|
||||||
stats = {
|
|
||||||
'token': requests.post('{}/api/tokenservices'.format(configuration.asa_url),
|
|
||||||
auth=(configuration.asa_username, configuration.asa_password), verify=False)
|
|
||||||
}
|
|
||||||
stats['headers'] = {'X-Auth-Token': stats['token'].headers['X-Auth-Token']}
|
|
||||||
stats['outside_interface'] = requests.get('{}/api/monitoring/device/interfaces/Outside'.format(configuration.asa_url),
|
|
||||||
headers=stats['headers'], verify=False).json()
|
|
||||||
|
|
||||||
influx_payload = [
|
|
||||||
{
|
|
||||||
"measurement": "bandwidth",
|
|
||||||
"tags": {
|
|
||||||
"interface": "outside"
|
|
||||||
},
|
|
||||||
"time": current_time,
|
|
||||||
"fields": {
|
|
||||||
"upload_bitrate": stats['outside_interface']['outputBitRate'],
|
|
||||||
"download_bitrate": stats['outside_interface']['inputBitRate']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
influx = InfluxDBClient(configuration.influxdb_url, configuration.influxdb_port, configuration.influxdb_username,
|
|
||||||
configuration.influxdb_password, configuration.asa_influxdb_db_name)
|
|
||||||
influx.write_points(influx_payload)
|
|
|
@ -1,35 +0,0 @@
|
||||||
import psutil
|
|
||||||
import mdstat
|
|
||||||
import platform
|
|
||||||
from datetime import datetime, timezone, timedelta
|
|
||||||
from influxdb import InfluxDBClient
|
|
||||||
|
|
||||||
# Do not edit below this line #
|
|
||||||
influx_payload = []
|
|
||||||
devices = {
|
|
||||||
'md': mdstat.parse()['devices'],
|
|
||||||
}
|
|
||||||
|
|
||||||
for array in devices['md']:
|
|
||||||
influx_payload.append(
|
|
||||||
{
|
|
||||||
"measurement": "Storage Servers",
|
|
||||||
"tags": {
|
|
||||||
"server": platform.uname()[1],
|
|
||||||
"mount_point": array,
|
|
||||||
"type": 'rebuild'
|
|
||||||
},
|
|
||||||
"time": datetime.now(timezone.utc).astimezone().isoformat(),
|
|
||||||
"fields": {
|
|
||||||
"resync_progress": float(devices['md'][array]['resync']['progress'].replace('%', '')),
|
|
||||||
"resync_eta_mins": float(devices['md'][array]['resync']['finish'].replace('min', '')),
|
|
||||||
"resync_eta_date": '{:%A, %b %d %I:%M %p}'.format(
|
|
||||||
datetime.now() + timedelta(minutes=float(devices['md'][array]['resync']['finish']
|
|
||||||
.replace('min', '')))),
|
|
||||||
"resync_speed_KiB/s": int(devices['md'][array]['resync']['speed'].replace('K/sec', '')),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
influx = InfluxDBClient('grafana.domain.tld', 8086, 'root', 'root', 'storage_server')
|
|
||||||
influx.write_points(influx_payload)
|
|
|
@ -1,36 +0,0 @@
|
||||||
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