add untracked files

This commit is contained in:
2024-11-27 10:16:41 +01:00
parent 007bd1614a
commit 396053a94f
45 changed files with 3128 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
#!/usr/bin/python -u
#
# Imports
#
import sys
import time
import commands
import argparse
#
# Methods
#
def get_temperature(disks):
command = "sudo smartctl -a /dev/%s | grep Temperature_Celsius | awk '{print $10}'" % disk
status, output = commands.getstatusoutput(command)
try:
return int(output)
except Exception as e:
return None
#
# Settings
#
hostname = 'server'
interval = 10
disks = ['sdd', 'sde', 'sdf']
#
# Main
#
while True:
timestamp = int(time.time())
for disk in disks:
temperature = get_temperature(disk)
if temperature:
print('PUTVAL {}/exec-temperature/gauge-{}_total {}:{}'.format(hostname, disk, timestamp, temperature))
time.sleep(interval)