HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //lib/python2.7/site-packages/lap/mclogmonitor.py
#!/usr/bin/python
import socket
import fcntl
import struct
import array
import glob
import re
import platform
import yaml
import commands

def __run__(params):
    try:
        thresholds = yaml.load(params.get('thresholds'))
        maximalpolicytime = params.get('maximalpolicytime',10.0)
        status,output = commands.getstatusoutput("tail -n 1000 /var/log/trex/traffic.log")
        line_error = []
        if "mcingress" in socket.gethostname():
            for line in output.split("\n"):
                line = line.strip()
                if "Policy t=0,0" in line:
                    policytime=float(line.split("Policy t=")[1].split("|")[0].split(",")[-1])
                    if policytime > maximalpolicytime:
                        return [2,'CRITICAL: Policy is taking %s seconds' % policytime]
        elif "mcegress" in socket.gethostname():
            for line in output.split("\n"):
                line = line.strip()
                if "x-authuser" in line and "b=" not in line:
                    line_error.append(line)
            if len(line_error) > thresholds['critical']:
                return [2, 'CRITICAL: %d lines in trex logs without b=' % len(line_error)]
            elif len(line_error) > thresholds['warning']:
                return [1, 'WARNING: %d lines in trex logs without b=' % len(line_error)]
            else:
                return [0, 'OK']
        return [0, 'OK']
    except Exception as e:
        return [2,'CRITICAL: %s' % e]