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)
the module too 28931b7c63965793d698335cd32f2cd56c3eb7d4 root 2019-06-08 22:03:10
Memory 89a64ee592f8808156bfda9639be723a1f2158ce root 2019-06-08 22:02:43
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 28931b7c63965793d698335cd32f2cd56c3eb7d4 - the module too
Author: root
Author date (UTC): 2019-06-08 22:03
Committer name: root
Committer date (UTC): 2019-06-08 22:03
Parent(s): 89a64ee592f8808156bfda9639be723a1f2158ce
Signing key:
Tree: b520ea302ac7743c1fb1c30e72725c59687f5905
File Lines added Lines deleted
metrics.d/LinuxMem.py 22 0
File metrics.d/LinuxMem.py added (mode: 100755) (index 0000000..50327b8)
1 #!/usr/bin/python3
2
3 import time
4 import socket
5 import sys
6 import os
7 import re
8
9 def mem():
10 file = open("/proc/meminfo","r")
11 lines = file.readlines()
12
13 now = int(time.time())
14 met = ""
15 for line in lines:
16 values=line.split(":")
17 for memType in ["MemTotal","MemFree","MemAvailable","Buffers","Cached","SwapTotal","SwapFree","Dirty"]:
18 if (memType in values):
19 met=met+"%s.%s.system.memory.%s %s %s\n" % (sys.platform,os.uname()[1],memType,re.sub('[^0-9]','', values[1]),now)
20 return met
21 file.close()
22
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