function ntlmauthenticator()
{
    $sock = new sockets();
    $MonitConfig = unserialize(base64_decode($sock->GET_INFO("SquidWatchdogMonitConfig")));
    $MonitConfig = watchdog_config_default($MonitConfig);
    $unix = new unix();
    $cacheFile = "/usr/share/artica-postfix/ressources/logs/web/ntlmauthenticator.cache";
    if (!$unix->isSquidNTLM()) {
        if ($GLOBALS["VERBOSE"]) {
            echo "NOT an NTLM proxy\n";
        }
        @unlink($cacheFile);
        return;
    }
    $ADDNNEW = false;
    $datas = explode("\n", $unix->squidclient("ntlmauthenticator"));
    $CPU_NUMBER = 1;
    $ARRAY = array();
    if ($GLOBALS["VERBOSE"]) {
        echo "Watchdog enabled: {$MonitConfig["watchdog"]}\n";
    }
    while (list($num, $ligne) = each($datas)) {
        if (preg_match("#by kid([0-9]+)#", $ligne, $re)) {
            $CPU_NUMBER = $re[1];
            continue;
        }
        if (preg_match("#number active: ([0-9]+) of ([0-9]+)#", $ligne, $re)) {
            $Active = intval($re[1]);
            $Max = intval($re[2]);
            $prc = round($Active / $Max * 100);
            $ARRAY[$CPU_NUMBER] = $prc;
        }
    }
    if (count($ARRAY) == 0) {
        return;
    }
    if ($MonitConfig["watchdog"] == 1) {
        while (list($CPU, $PRC) = each($ARRAY)) {
            if ($GLOBALS["VERBOSE"]) {
                echo "CPU.{$CPU} = {$PRC}%\n";
            }
            Events("ntlmauthenticator: CPU.{$CPU} = {$PRC}%");
            $LOG[] = "Instance on CPU {$CPU} is {$PRC}% used.";
            if ($PRC > 94) {
                if ($Max + 5 < 151) {
                    $NewMax = $Max + 5;
                    $ADDNNEW = true;
                    squid_admin_mysql(2, "NTLM Authenticator on CPU {$CPU} reach 95%", "Artica will increase your ntlm authenticator processes to {$NewMax} instances \n\t\t\t\t\tper CPU and reload the Proxy service\r\nCurrent status:\r\n" . @implode("\r\n", $LOG));
                }
            }
        }
    }
    if ($ADDNNEW) {
        if ($NewMax > 0) {
            $squid = new squidbee();
            $SquidClientParams = unserialize(base64_decode(@file_get_contents("/etc/artica-postfix/settings/Daemons/SquidClientParams")));
            $Old = $squid->auth_param_ntlm_children();
            $SquidClientParams["auth_param_ntlm_children"] = $NewMax;
            $SquidClientParams["auth_param_ntlm_startup"] = round($NewMax * 0.2);
            @file_put_contents("/etc/artica-postfix/settings/Daemons/SquidClientParams", base64_encode(serialize($SquidClientParams)));
            if (ntlmauthenticator_edit($NewMax)) {
                $squid = $unix->LOCATE_SQUID_BIN();
                $php = $unix->LOCATE_PHP5_BIN();
                if (function_exists("debug_backtrace")) {
                    $trace = debug_backtrace();
                    if (isset($trace[1])) {
                        $file = basename($trace[1]["file"]);
                        $function = $trace[1]["function"];
                        $line = $trace[1]["line"];
                        $called = "Called by {$function}() from line {$line}";
                    }
                }
                squid_admin_mysql(1, "Reconfiguring squid-cache Increase NTLM From {$Old} to {$NewMax}", "{$called}");
                shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
            }
        }
    }
    @file_put_contents($cacheFile, serialize($ARRAY));
    @chmod($cacheFile, 0755);
}