From 929ffd6f8f18b1d80d721a9e3ff6a39978544fb6 Mon Sep 17 00:00:00 2001 From: "Nicholas St. Germain" Date: Thu, 6 Dec 2018 14:39:04 -0600 Subject: [PATCH] Deleted out of scope scripts. Closes #41 --- Legacy/cisco_asa.py | 34 ---------------------------------- Legacy/raid_init.py | 35 ----------------------------------- Legacy/san.py | 36 ------------------------------------ 3 files changed, 105 deletions(-) delete mode 100644 Legacy/cisco_asa.py delete mode 100644 Legacy/raid_init.py delete mode 100644 Legacy/san.py diff --git a/Legacy/cisco_asa.py b/Legacy/cisco_asa.py deleted file mode 100644 index 33ebe440..00000000 --- a/Legacy/cisco_asa.py +++ /dev/null @@ -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) diff --git a/Legacy/raid_init.py b/Legacy/raid_init.py deleted file mode 100644 index 4145bdd5..00000000 --- a/Legacy/raid_init.py +++ /dev/null @@ -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) diff --git a/Legacy/san.py b/Legacy/san.py deleted file mode 100644 index bb7de3d0..00000000 --- a/Legacy/san.py +++ /dev/null @@ -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)