Commit 6fbc9dca authored by Jonathan Schaeffer's avatar Jonathan Schaeffer
Browse files

Version fonctionnelle du script.

parent 64cc1c9e
config.yml
venv/
test/
#
# Configuration file for resif_data_reporter.py
#
logger_file: "logger.conf" # path for the logger configuration file
volumes: # list of directories to scan
- /path/1
- /data/all/example
influxdb: # influxdb database to send reports
measurement: validated_data # measurement name
server: osug-influxdb.u-ga.fr # server name
port: 8086 # port number
ssl: True # use SSL ?
verify_ssl: False # verify SSL certificate ?
user: resifmonitor # user to connect to
password: iiKa5GfvDzWDXyE797 # password for the user
database: sandbox # database name
tags: # list of tags to add to metrics, key values pairs
- host: localhost
metadata: # Information about the gathered data. Used to tag the timeserie values
permanent_networks: # List all permanent networks here. Otherwise, they will be considered as temporary
- CL
- GL
- MT
- MQ
- ND
- PF
- RD
- FR
- G
- RA
- WI
certifi==2018.10.15
chardet==3.0.4
idna==2.7
influxdb==5.2.0
python-dateutil==2.7.5
pytz==2018.7
PyYAML==3.13
requests==2.20.1
six==1.11.0
urllib3==1.24.1
......@@ -60,12 +60,15 @@ def main():
influxdb_json_data = []
for volume in cfg['volumes']:
volume = volume.rstrip('/')+'/'
# TODO mettre le niveau de profondeur (2) en option
lines = subprocess.check_output(["du", "-d2", volume]).decode("utf-8").splitlines()
for l in lines:
logger.debug(l)
(size, path) = l.split('\t')
path = path.split('/')[-2:]
# On ne garde que le chemin qui nous intéresse
path = path.replace(volume,'').split('/')
# Ne pas considérer le seul chemin de niveau 1
if len(path) == 2:
logger.debug(f"path : {path}")
logger.debug(f"size : {size}")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment