HEX
Server: LiteSpeed
System: Linux pl-rocket-da1.hostsila.org 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: etorby24eu (1588)
PHP: 8.3.23
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //proc/self/root/opt/node_api/metrics.hook
#!/usr/bin/python
import os
import json
import re

def chomp(x):
    if x.endswith("\r\n"): return x[:-2]
    if x.endswith("\n"): return x[:-1]
    return x

def io():
	data = os.popen('/opt/node_api/io.hook').read()
	print data.strip()

def get_data():
	result={}
	cpu={}
	try:
		data = os.popen('ipmi-sensors -h localhost --quiet-cache --sdr-cache-recreate --interpret-oem-data --output-sensor-state --ignore-not-available-sensors  --comma-separated-output --no-header-output').readlines()
		for line in data:
			x =  line.split(',')
			if 'CPU' in line:
	                    	cpus = re.search('CPU(.*?) Temp', x[1], re.M | re.I)
                                if x[4]!="N/A":
                                        print 'node_cpu{cpu="cpu' + cpus.group(1) + '",mode="temp"} ' + x[4]
			if 'PCH Temp' in line:
				print 'node_pch_temp ' + x[4]
                        if 'Peripheral Temp' in line:
                                print 'node_peripheral_temp ' + x[4]
                        if 'System Temp' in line:
                                print 'node_system_temp ' + x[4]
	except:
		return False

def main():
	io()

if __name__ == "__main__":
	main()