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/check_pmta_fila.py
#!/usr/bin/env python
# encoding: utf-8
import yaml
import urllib2
import xml.dom.minidom
from urlparse import urlparse
from xml.dom.minidom import parseString

def __run__(params):
    try:
        theurl = 'http://localhost:8080/status?format=xml'
        req = urllib2.Request(theurl)
        try:
            thresolds = yaml.load(params.get('thresholds'))
            handle = urllib2.urlopen(req)
        except IOError, e:
            if hasattr(e, 'code'):
                if e.code != 401:
                    return [2, 'CRITICAL: {0}'.format(str(e.code))]
                else:
                    print e.headers
                    return [2, 'CRITICAL: {0}'.format(str(e.code))]
        theurl = handle.read()
        doc = parseString(theurl)

        for queue in doc.getElementsByTagName("smtp"):
            rcp = queue.getElementsByTagName("rcp")
            AlertInfo = rcp[0].toxml().replace("<rcp>","")
            queue_n = int(AlertInfo.replace("</rcp>",""))
            if queue_n > thresolds['critical']:
                return [2, 'CRITICAL - {0} in queue'.format(str(queue_n)), "queue=%s" % (queue_n)]
            elif queue_n > thresolds['warning']:
                return [1, 'WARNING - {0} in queue'.format(str(queue_n)), "queue=%s" % (queue_n)]
            else:
                return [0, 'OK - {0} in queue'.format(str(queue_n)), "queue=%s" % (queue_n)]

    except Exception as e:
        return [2, 'CRITICAL: {0}'.format(str(e))]