diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2018-07-17 12:34:04 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2018-07-17 12:49:49 +0200 |
commit | 69c220cda3d8c0a95327630f5752dad36cb82261 (patch) | |
tree | fad9fbe78cf717f4dd17b8e9d996ab9a54b7d3e2 /jobs/sys_network.py | |
download | datasources-69c220cda3d8c0a95327630f5752dad36cb82261.tar.gz datasources-69c220cda3d8c0a95327630f5752dad36cb82261.zip |
Squashed commit
Diffstat (limited to 'jobs/sys_network.py')
-rwxr-xr-x | jobs/sys_network.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/jobs/sys_network.py b/jobs/sys_network.py new file mode 100755 index 0000000..bbd6a0b --- /dev/null +++ b/jobs/sys_network.py @@ -0,0 +1,15 @@ +import socket + + +def job(device, stat_type): + f = open('/sys/class/net/' + device + '/statistics/' + stat_type, 'r') + value = f.read() + ivalue = int(value.replace("\n", "")) + f.close() + return {'hostname': socket.gethostname(), 'device': device, 'stat_type': stat_type, 'value': ivalue} + + +if __name__ == "__main__": + from pprint import pprint + + pprint(job("eth1", "rx_bytes")) |