V1rus Private
User / IP
:
216.73.217.108
Host / Server
:
190.92.174.125 / aerosofthealthcare.com
System
:
Linux s3739.bom1.stableserver.net 4.18.0-513.24.1.lve.2.el8.x86_64 #1 SMP Fri May 24 12:42:50 UTC 2024 x86_64
Cmd
|
Upload
|
Mass Deface
|
Create
|
Sym
:
/
lib64
/
nagios
/
plugins
/
Viewing: check_a2_cpu_throttle.shared
#!/usr/bin/python3 import os import subprocess import socket # Check if the hostname contains "vplatform" - BFENG-1670 hostname = socket.gethostname() if "vplatform" in hostname: print("check not applicable this is vplatform server - OK") exit(0) # allow our agents to whitelist SEL events if os.path.isfile('/opt/hwflags/event.whitelist'): with open('/opt/hwflags/event.whitelist','r') as f: whitelist = f.read().split('\n') else: whitelist = [] try: # Start off assumning no issues problem = False # Parse ipmitool output o = subprocess.check_output(['/bin/ipmitool','sel','elist']) s = str(o,encoding='utf-8',errors='replace') lines = s.split('\n') # Go through each line of output. for l in lines: f = l.split('|') # look only for lines which mention processor throttling if len(f) >= 5 and 'Processor' in f[3] and 'Throttled' in f[4]: eid = f[0].strip() if 'Asserted' in f[5] and not eid in whitelist: # Asserted means thottling has started. We might have a problem. problem = True elif 'Deasserted' in f[5]: # Deasserted means throttling has stopped. We no longer have a problem. problem = False if problem: # An assertion not followed by deassertion is found, CPU is probably throttled. print ("throttling detected!") exit(2) else: # No assertions in SEL or all are followed by deassertion. print ("no throttling detected.") exit(0) except FileNotFoundError: # ipmitool returned a file not found error. print ("ipmitool binary missing.") exit(3) except subprocess.CalledProcessError: # ipmitool returned a different error. print ("error running ipmitool.") exit(3)
Coded With 💗 by
HanzOFC