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/check_mk_agent/local/locaweb-mtu
#!/usr/bin/python
'''
Envia um pacote de ping com mais de 1500 bytes e checa se foi fragmentado
'''

import os
import random
import subprocess
import ConfigParser

config_file = "/etc/locaweb/monitoring/plugins.conf"
if os.path.isfile(config_file):
    config = ConfigParser.ConfigParser()
    config.read(config_file)
    blacklist = config.get("mtu", "blacklist").split()
else:
    blacklist = []

def main():
    ''' Funcao principal '''
    # Pega um ponto de montagem nfs aleatorio para fazer o teste
    nfs = []
    for line in [ line.strip().split() for line in open("/etc/mtab").readlines() ]:
        if line[2] == 'nfs' and line[0] not in blacklist:
            nfs.append(line[0].split(":")[0])

    if len(nfs) == 0:
        print "0 Check_MTU status=0 OK - no NFS mount found"
        return

    nfs = random.choice(nfs)

    # testa o ping naquele ponto de montagem nfs
    p = subprocess.Popen(
            ['ping', '-w', '3', '-c', '1', '-s', '2000', '-M', 'do', nfs],
            stdin=subprocess.PIPE,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            close_fds=True)
    retcode = p.wait()
    if retcode == 0:
        print "0 Check_MTU status=0 OK - %s" % nfs
    elif retcode == 2:
        print "1 Check_MTU status=1 WARNING - %s, check ping permissions" % nfs
    else:
        print "2 Check_MTU status=2 CRITICAL - %s" % nfs
    return

if __name__ == '__main__':
    main()