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: //usr/lib/python2.7/site-packages/lap/nginx_status.py
import os
import sys
import yaml
import urllib2

def __run__(params):
    url = params['url']
    critical = params['critical']
    warning = params['warning']

    try:
        req = urllib2.Request(url)
        response = urllib2.urlopen(req)
        the_page = response.readline()
        conn = the_page.split()
        ActiveConn = conn[2]
        page_line1 = response.readline()
        page_line2 = response.readline()
        page_line3 = response.readline()
        code = response.getcode()
        response.close()
        stats = page_line3.split()
        reading = stats[1]
        writing = stats[3]
        waiting = stats[5]
        output = 'ActiveConn:(%s), Reading:(%s), Writing:(%s), Waiting:(%s)' % (ActiveConn,reading,writing,waiting)
        perfdata = 'ActiveConn=%s|reading=%s|writing=%s|waiting=%s' % (ActiveConn,reading,writing,waiting)

        if int(ActiveConn) >= critical:
            return [ 2,'CRITICAL - %s' % output, perfdata ]
        elif int(ActiveConn) >= warning:
            return [ 1,'WARNING - %s' % output, perfdata ]
        else:
            return [ 0,'OK - %s' % output, perfdata ]

    except urllib2.HTTPError, e:
        return [ 2, 'CRITICAL - Error opening URL, HTTP code: %s' % e.code ]
    except urllib2.URLError, e:
        return [ 2, 'CRITICAL - Error getting Connection: %s' % e.args ]
    except Exception, e:
        return [ 3, "UNKNOWN - ERROR \"%s\"" % e ]