mihai.leontescu / metrics (public) (License: GPLv3) (since 2018-07-12) (hash sha1)
Metrics for Linux to feed to Graphite in python
Disclaimer: I am not a programmer, I know some things can be done better. I choose to do them so, so I am able to understand them 80 years later :)
List of commits:
Subject Hash Author Date (UTC)
pam pam a49f891505bf8fb0ef5feaf5bbb9e32056044608 root 2019-06-07 21:57:53
oh hell.. 6e51570fbf7b9e608a39fe889878730b2da5fdc3 mihai.leontescu 2018-07-12 19:35:22
out with the logfiles :) 7ab23b68dd2baf3f0ffd0b143c7d81cb4050b48c mihai.leontescu 2018-07-12 19:34:34
graphana examples 63d6edb628092720782795a1385349fe14fa7e58 mihai.leontescu 2018-07-12 19:34:02
initial commit pre-alpha d4f64fe23a814b563d1df7fea142daae8aaa0a75 mihai.leontescu 2018-07-12 19:29:49
Commit a49f891505bf8fb0ef5feaf5bbb9e32056044608 - pam pam
Author: root
Author date (UTC): 2019-06-07 21:57
Committer name: root
Committer date (UTC): 2019-06-07 21:57
Parent(s): 6e51570fbf7b9e608a39fe889878730b2da5fdc3
Signing key:
Tree: b7d1b588d01ab1c5ff31c9a3bfe32f0d59a2be60
File Lines added Lines deleted
conf/metrics.conf 0 0
graphana_examples/shuttle-system.json 0 0
logs/.gitignore 0 1
logs/metrics.log 0 189336
metrics.d/LinuxCPU.py 0 0
metrics.d/LinuxDisk.py 0 0
metrics.d/LinuxNetwork.py 0 0
metrics.d/__pycache__/LinuxCPU.cpython-33.pyc 0 0
metrics.d/__pycache__/LinuxDisk.cpython-33.pyc 0 0
metrics.d/__pycache__/LinuxNetwork.cpython-33.pyc 0 0
metrics.d/__pycache__/LinuxSystem.cpython-33.pyc 0 0
metrics.py 15 0
File conf/metrics.conf changed (mode: 100755 -> 100644)
File graphana_examples/shuttle-system.json changed (mode: 100755 -> 100644)
File logs/.gitignore deleted (index 72e8ffc..0000000)
1 *
The diff for file logs/metrics.log is too big (189336 changes) and cannot be shown.
File metrics.d/LinuxCPU.py changed (mode: 100755 -> 100644)
File metrics.d/LinuxDisk.py changed (mode: 100755 -> 100644)
File metrics.d/LinuxNetwork.py changed (mode: 100755 -> 100644)
File metrics.d/__pycache__/LinuxCPU.cpython-33.pyc deleted (index e3e4b3e..0000000)
File metrics.d/__pycache__/LinuxDisk.cpython-33.pyc deleted (index 2aefbaa..0000000)
File metrics.d/__pycache__/LinuxNetwork.cpython-33.pyc deleted (index d08434d..0000000)
File metrics.d/__pycache__/LinuxSystem.cpython-33.pyc deleted (index e88d8ab..0000000)
File metrics.py changed (mode: 100755) (index f0d7659..735b328)
... ... MetricsLocation=Path+"/metrics.d"
14 14
15 15 sys.path.append(MetricsLocation) sys.path.append(MetricsLocation)
16 16
17 #TODO:
18 # - proper fork
19 # - startup script
20 # - proper logging with levels read for each iteration
21 # - LinuxMemory
22 # - LinuxDisk more metrics
23 # - dynamic import based on config file (list of modules would be faaaantastic) -> see importlib
24
25
26
27
17 28 ## Read from Configfile ## Read from Configfile
18 29 with open(ConfigFileLocation,'r') as ConfigFile: with open(ConfigFileLocation,'r') as ConfigFile:
19 30 Configuration = json.load(ConfigFile) Configuration = json.load(ConfigFile)
 
... ... def graphSend(content):
36 47 s.sendall(content.encode()) s.sendall(content.encode())
37 48 s.close() s.close()
38 49
50
51 if os.fork():
52 sys.exit()
53
39 54 try: try:
40 55 import LinuxNetwork import LinuxNetwork
41 56 import LinuxDisk import LinuxDisk
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mihai.leontescu/metrics

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mihai.leontescu/metrics

Clone this repository using git:
git clone git://git.rocketgit.com/user/mihai.leontescu/metrics

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main