• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utime函数的典型用法代码示例。如果您正苦于以下问题:PHP utime函数的具体用法?PHP utime怎么用?PHP utime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了utime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: search

 function search($uname, &$u)
 {
     $utimer = utime();
     $filter = '(sAMAccountName=' . $uname . ')';
     if ($result = ldap_search($this->c, LDAPTREE, $filter)) {
         $data = ldap_get_entries($this->c, $result);
         $keys = array_keys($data[0]);
         $member = '';
         while (list($k, $v) = each($keys)) {
             //  echo "<!-- [$v] -->\n";
             if (isset($u->{$v})) {
                 if ($v == 'memberof') {
                     for ($i = 0; $i < $data[0][$v]['count']; $i++) {
                         $member .= $data[0][$v][$i] . ';';
                     }
                     $u->{$v} = $member;
                 } else {
                     $u->{$v} = $data[0][$v]['0'];
                 }
             }
             // debug - et mis meil üldse AD'st saada on
             //  $uu = $data['0'][$v]['0'];
             //  echo "<!-- $v = $uu -->\n";
         }
         if ($this->debug) {
             $t = stop_utimer($utimer);
             $this->m[] = "<!-- LDAP [{$t}] userdata for [{$uname}] -->\n";
         }
         return true;
     }
     return false;
 }
开发者ID:jotttt,项目名称:auth,代码行数:32,代码来源:class_ldap.php


示例2: add_to_timeline

function add_to_timeline($timestamp, $type, $title, $url)
{
    global $conf, $timeline;
    $utime = utime();
    $time_since = $utime - $conf->last_utime;
    $conf->last_utime = $utime;
    echo "{$time_since} [{$type}]: {$timestamp} - {$title}<br />\n";
    $timeline[$timestamp][] = array("type" => $type, "url" => $url, "title" => $title);
}
开发者ID:enascimento,项目名称:carmack,代码行数:9,代码来源:misc_tools.php


示例3: parse

 public function parse($vars, $fname)
 {
     $utimer = utime();
     $this->vars = $vars;
     // loop peab nägema
     $this::open($fname, 'r');
     $this->content = $this::read();
     $parsed = $this::rip_open_and_do_replacements($vars);
     if ($this->debug) {
         $this->msg[] = "<!-- file: [{$fname}] parsed in " . stop_utimer($utimer) . " s. -->\n";
     }
     return $parsed;
 }
开发者ID:jotttt,项目名称:auth,代码行数:13,代码来源:class_template.php


示例4: conf

 function conf()
 {
     $this->now = date("YmdHi");
     $this->last_utime = utime();
     $this->created_on = "created_on_{$this->now}";
     $this->compiled_on = date("l dS \\of F Y h:i:s A");
     $this->user = "johnc";
     $this->keywords = "John, Carmack, id, archive, compilation, doom, quake";
     $this->title = "The John Carmack Archive";
     $this->fullname = "John Carmack";
     $this->header = read_file("template/header.html");
     $this->footer = read_file("template/footer.html");
 }
开发者ID:enascimento,项目名称:carmack,代码行数:13,代码来源:conf.php


示例5: debug

 function debug($mode, $cur_query = null)
 {
     if (!$this->dbg_enabled) {
         return;
     }
     $id =& $this->dbg_id;
     $dbg =& $this->dbg[$id];
     if ($mode == 'start') {
         $this->sql_starttime = utime();
         $dbg['sql'] = isset($cur_query) ? short_query($cur_query) : short_query($this->cur_query);
         $dbg['src'] = $this->debug_find_source();
         $dbg['file'] = $this->debug_find_source('file');
         $dbg['line'] = $this->debug_find_source('line');
         $dbg['time'] = '';
     } else {
         if ($mode == 'stop') {
             $this->cur_query_time = utime() - $this->sql_starttime;
             $this->sql_timetotal += $this->cur_query_time;
             $dbg['time'] = $this->cur_query_time;
             $id++;
         }
     }
 }
开发者ID:forummaks,项目名称:forum_maks,代码行数:23,代码来源:common.php


示例6: discover_device

function discover_device($device, $options = NULL)
{
    global $config, $valid, $exec_status, $discovered_devices;
    // Initialise variables
    $valid = array();
    // Reset $valid array
    $modules = array();
    $cache_discovery = array();
    // Specific discovery cache for exchange snmpwalk data between modules (memory/storage/sensors/etc)
    $attribs = get_entity_attribs('device', $device['device_id']);
    $device_start = utime();
    // Start counting device poll time
    // Check if device discovery already running
    $pid_info = check_process_run($device);
    if ($pid_info) {
        // Process ID exist in DB
        print_message("%rAnother " . $pid_info['process_name'] . " process (PID: " . $pid_info['PID'] . ", UID: " . $pid_info['UID'] . ", STARTED: " . $pid_info['STARTED'] . ") already running for device " . $device['hostname'] . " (" . $device['device_id'] . ").%n", 'color');
        return FALSE;
    }
    add_process_info($device);
    // Store process info
    print_cli_heading($device['hostname'] . " [" . $device['device_id'] . "]", 1);
    $detect_os = TRUE;
    // Set TRUE or FALSE for module 'os' (exclude double os detection)
    if ($device['os'] == 'generic' || isset($options['h']) && $options['h'] == 'new') {
        $detect_os = FALSE;
        $old_os = $device['os'];
        $device['os'] = get_device_os($device);
        if ($device['os'] != $old_os) {
            print_cli_data("Device OS changed", $old_os . " -> " . $device['os'], 1);
            log_event('OS changed: ' . $old_os . ' -> ' . $device['os'], $device, 'device', $device['device_id'], 'warning');
            dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id']));
        }
    }
    print_cli_data("OS Type", $device['os'], 1);
    if ($config['os'][$device['os']]['group']) {
        $device['os_group'] = $config['os'][$device['os']]['group'];
        print_cli_data("OS Group", $device['os_group'], 1);
    }
    print_cli_data("SNMP Version", $device['snmp_version'], 1);
    print_cli_data("Last discovery", $device['last_discovered'], 1);
    print_cli_data("Last duration", $device['last_discovered_timetaken'] . " seconds", 1);
    echo PHP_EOL;
    // Either only run the modules specified on the commandline, or run all modules in config.
    if ($options['m']) {
        foreach (explode(",", $options['m']) as $module) {
            $modules[$module] = TRUE;
        }
    } else {
        if ($device['force_discovery'] && $options['h'] == 'new' && isset($attribs['force_discovery_modules'])) {
            // Forced discovery specific modules
            foreach (json_decode($attribs['force_discovery_modules'], TRUE) as $module) {
                $modules[$module] = TRUE;
            }
            log_event('Forced discovery module(s): ' . implode(', ', array_keys($modules)), $device, 'device', $device['device_id'], 'debug');
        } else {
            $modules = $config['discovery_modules'];
        }
    }
    // Use os specific modules order
    //print_vars($modules);
    if (isset($config['os'][$device['os']]['discovery_order'])) {
        //print_vars($config['os'][$device['os']]['discovery_order']);
        foreach ($config['os'][$device['os']]['discovery_order'] as $module => $module_order) {
            if (array_key_exists($module, $modules)) {
                $module_status = $modules[$module];
                switch ($module_order) {
                    case 'last':
                        // add to end of modules list
                        unset($modules[$module]);
                        $modules[$module] = $module_status;
                        break;
                    case 'first':
                        // add to begin of modules list, but not before os/system
                        $new_modules = array();
                        if ($modules['os']) {
                            $new_modules['os'] = $modules['os'];
                            unset($modules['os']);
                        }
                        if ($modules['system']) {
                            $new_modules['system'] = $modules['system'];
                            unset($modules['system']);
                        }
                        $new_modules[$module] = $module_status;
                        unset($modules[$module]);
                        $modules = $new_modules + $modules;
                        break;
                    default:
                        // add into specific place (after module name in $module_order)
                        // yes, this is hard and magically
                        if (array_key_exists($module_order, $modules)) {
                            unset($modules[$module]);
                            $new_modules = array();
                            foreach ($modules as $new_module => $new_status) {
                                array_shift($modules);
                                $new_modules[$new_module] = $new_status;
                                if ($new_module == $module_order) {
                                    $new_modules[$module] = $module_status;
                                    break;
                                }
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:functions.inc.php


示例7: print_debug

            $mask = $mask != NULL ? $mask : '32';
            $range = $net . '/' . $mask;
            if ($mask >= 0 && $mask <= 32 && Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $range)) {
                $auth = TRUE;
                // hardcode authenticated for matched subnet
                print_debug("认证的CIDR匹配IPv4 {$range}.");
                break;
            }
        } elseif (Net_IPv6::checkIPv6($net)) {
            // IPv6
            $mask = $mask != NULL ? $mask : '128';
            $range = $net . '/' . $mask;
            if ($mask >= 0 && $mask <= 128 && Net_IPv6::isInNetmask($_SERVER['REMOTE_ADDR'], $range)) {
                $auth = TRUE;
                // hardcode authenticated for matched subnet
                print_debug("认证的CIDR匹配IPv6 {$range}");
                break;
            }
        }
    }
}
if (!$auth) {
    // Normal auth
    include $config['html_dir'] . "/includes/authenticate.inc.php";
}
// Push $_GET into $vars to be compatible with web interface naming
$vars = get_vars('GET');
include $config['html_dir'] . "/includes/graphs/graph.inc.php";
$runtime = utime() - $start;
print_debug("运行时间 " . $runtime . " 秒");
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:graph.php


示例8: ob_get_contents

        $panel_html = ob_get_contents();
        ob_end_clean();
        register_html_panel($panel_html);
    }
} else {
    if ($config['auth_mechanism'] == 'cas') {
        // Not Authenticated. CAS logon.
        echo 'Not authorized.';
        exit;
    } else {
        // Not Authenticated. Print login.
        include $config['html_dir'] . "/pages/logon.inc.php";
        exit;
    }
}
$gentime = utime() - $runtime_start;
$fullsize = memory_get_usage();
unset($cache);
$cachesize = $fullsize - memory_get_usage();
if ($cachesize < 0) {
    $cachesize = 0;
}
// Silly PHP!
?>
</div>

<?php 
if ($vars['bare'] != 'yes') {
    ?>

<div class="navbar navbar-fixed-bottom">
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:index.php


示例9: pla_error

                    }
                    $filter = "({$attr}=*{$filter})";
                    break;
                case 'equals':
                    $filter = "({$attr}={$filter})";
                    break;
                case 'sounds like':
                    $filter = "({$attr}~={$filter})";
                    break;
                default:
                    pla_error("Unrecognized criteria option: " . htmlspecialchars($criterion) . "If you want to add your own criteria to the list. Be sure to edit " . "search.php to handle them. Quitting.");
            }
        }
        $time_start = utime();
        $results = pla_ldap_search($server_id, $filter, $base_dn, $search_result_attributes, $scope);
        $time_end = utime();
        $time_elapsed = round($time_end - $time_start, 2);
        $count = count($results);
        ?>

		<br />
		<center>Found <b><?php 
        echo $count;
        ?>
</b> <?php 
        echo $count == 1 ? 'entry' : 'entries';
        ?>
.

		<?php 
        if ($form == 'simple') {
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:31,代码来源:search.php


示例10: accept

 public function accept()
 {
     $server = $this->getServer();
     # Get the data to be exported
     $query = array();
     $base = get_request('dn', 'REQUEST');
     $query['baseok'] = true;
     $query['filter'] = get_request('filter', 'REQUEST', false, 'objectclass=*');
     $query['scope'] = get_request('scope', 'REQUEST', false, 'base');
     $query['deref'] = $_SESSION[APPCONFIG]->getValue('deref', 'export');
     $query['size_limit'] = 0;
     $attrs = get_request('attributes', 'REQUEST');
     $attrs = preg_replace('/\\s+/', '', $attrs);
     if ($attrs) {
         $query['attrs'] = explode(',', $attrs);
     } else {
         $query['attrs'] = array('*');
     }
     if (get_request('sys_attr')) {
         if (!in_array('*', $query['attrs'])) {
             array_push($query['attrs'], '*');
         }
         array_push($query['attrs'], '+');
     }
     if (!$base) {
         $bases = $server->getBaseDN();
     } else {
         $bases = array($base);
     }
     foreach ($bases as $base) {
         $query['base'] = $base;
         $time_start = utime();
         $this->results[$base] = $server->query($query, null);
         $time_end = utime();
         usort($this->results[$base], 'pla_compare_dns');
         $this->resultsdata[$base]['time'] = round($time_end - $time_start, 2);
         # If no result, there is a something wrong
         if (!$this->results[$base] && $server->getErrorNum(null)) {
             system_message(array('title' => _('Encountered an error while performing search.'), 'body' => ldap_error_msg($server->getErrorMessage(null), $server->getErrorNum(null)), 'type' => 'error'));
         }
         $this->items += count($this->results[$base]);
     }
     $this->resultsdata['scope'] = $query['scope'];
     $this->resultsdata['filter'] = $query['filter'];
     $this->resultsdata['attrs'] = $query['attrs'];
     # Other settings
     switch (get_request('format', 'POST', false, 'unix')) {
         case 'win':
             $this->br = "\r\n";
             break;
         case 'mac':
             $this->br = "\r";
             break;
         case 'unix':
         default:
             $this->br = "\n";
     }
     if (get_request('compress', 'REQUEST') == 'on') {
         $this->compress = true;
     }
 }
开发者ID:dannylsl,项目名称:phpLDAPadmin,代码行数:61,代码来源:export_functions.php


示例11: poll_device

function poll_device($device, $options)
{
    global $config, $debug, $device, $polled_devices, $db_stats, $memcache;
    $old_device_state = unserialize($device['device_state']);
    $attribs = get_dev_attribs($device['device_id']);
    $status = 0;
    unset($array);
    $device_start = utime();
    // Start counting device poll time
    echo $device['hostname'] . " " . $device['device_id'] . " " . $device['os'] . " ";
    if ($config['os'][$device['os']]['group']) {
        $device['os_group'] = $config['os'][$device['os']]['group'];
        echo "(" . $device['os_group'] . ")";
    }
    echo "\n";
    unset($poll_update);
    unset($poll_update_query);
    unset($poll_separator);
    $poll_update_array = array();
    $host_rrd = $config['rrd_dir'] . "/" . $device['hostname'];
    if (!is_dir($host_rrd)) {
        mkdir($host_rrd);
        echo "Created directory : {$host_rrd}\n";
    }
    $device['pingable'] = isPingable($device['hostname']);
    if ($device['pingable']) {
        $device['snmpable'] = isSNMPable($device);
        if ($device['snmpable']) {
            $status = "1";
            $status_type = '';
        } else {
            echo "SNMP Unreachable";
            $status = "0";
            $status_type = ' (snmp)';
        }
    } else {
        echo "Unpingable";
        $status = "0";
        $status_type = ' (ping)';
    }
    if ($device['status'] != $status) {
        $poll_update .= $poll_separator . "`status` = '{$status}'";
        $poll_separator = ", ";
        dbUpdate(array('status' => $status), 'devices', 'device_id=?', array($device['device_id']));
        dbInsert(array('importance' => '0', 'device_id' => $device['device_id'], 'message' => "Device is " . ($status == '1' ? 'up' : 'down')), 'alerts');
        log_event('Device status changed to ' . ($status == '1' ? 'Up' : 'Down') . $status_type, $device, 'system');
        notify($device, "Device " . ($status == '1' ? 'Up' : 'Down') . ": " . $device['hostname'] . $status_type, "Device " . ($status == '1' ? 'up' : 'down') . ": " . $device['hostname']);
    }
    $rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/status.rrd";
    if (!is_file($rrd)) {
        rrdtool_create($rrd, "DS:status:GAUGE:600:0:1 " . $config['rrd_rra']);
    }
    if ($status == "1" || $status == "0") {
        rrdtool_update($rrd, "N:" . $status);
    } else {
        rrdtool_update($rrd, "N:U");
    }
    // Ping response RRD database.
    $ping_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/ping.rrd';
    if (!is_file($ping_rrd)) {
        rrdtool_create($ping_rrd, "DS:ping:GAUGE:600:0:65535 " . $config['rrd_rra']);
    }
    if ($device['pingable']) {
        rrdtool_update($ping_rrd, "N:" . $device['pingable']);
    } else {
        rrdtool_update($ping_rrd, "N:U");
    }
    // SNMP response RRD database.
    $ping_snmp_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/ping_snmp.rrd';
    if (!is_file($ping_snmp_rrd)) {
        rrdtool_create($ping_snmp_rrd, "DS:ping_snmp:GAUGE:600:0:65535 " . $config['rrd_rra']);
    }
    if ($device['snmpable']) {
        rrdtool_update($ping_snmp_rrd, "N:" . $device['snmpable']);
    } else {
        rrdtool_update($ping_snmp_rrd, "N:U");
    }
    if ($status == "1") {
        $graphs = array();
        $oldgraphs = array();
        // Enable Ping graphs
        $graphs['ping'] = TRUE;
        // Enable SNMP graphs
        $graphs['ping_snmp'] = TRUE;
        if ($options['m']) {
            foreach (explode(",", $options['m']) as $module) {
                if (is_file("includes/polling/" . $module . ".inc.php")) {
                    include "includes/polling/" . $module . ".inc.php";
                }
            }
        } else {
            foreach ($config['poller_modules'] as $module => $module_status) {
                if ($attribs['poll_' . $module] || $module_status && !isset($attribs['poll_' . $module])) {
                    if ($debug) {
                        echo "including: includes/polling/{$module}.inc.php\n";
                    }
                    include 'includes/polling/' . $module . '.inc.php';
                } elseif (isset($attribs['poll_' . $module]) && $attribs['poll_' . $module] == "0") {
                    echo "Module [ {$module} ] disabled on host.\n";
                } else {
//.........这里部分代码省略.........
开发者ID:RomanBogachev,项目名称:observium,代码行数:101,代码来源:functions.inc.php


示例12: logfile

     logfile("Connection to UNIX agent on " . $agent_socket . " failed. ERROR: " . $errno . " " . $errstr);
     /// Try check_mk port if the official one doesn't work.
     $agent_port = "6556";
     $agent_start = utime();
     $agent_socket = "tcp://" . $device['hostname'] . ":" . $agent_port;
     $agent = @stream_socket_client($agent_socket, $errno, $errstr, 10);
     if (!$agent) {
         echo "Connection to UNIX agent on " . $agent_socket . " failed. ERROR: " . $errno . " " . $errstr . "\n";
         logfile("Connection to UNIX agent on " . $agent_socket . " failed. ERROR: " . $errno . " " . $errstr);
     } else {
         $agent_raw = stream_get_contents($agent);
     }
 } else {
     $agent_raw = stream_get_contents($agent);
 }
 $agent_end = utime();
 $agent_time = round(($agent_end - $agent_start) * 1000);
 if (!empty($agent_raw)) {
     echo "execution time: " . $agent_time . "ms";
     $agent_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/agent.rrd";
     if (!is_file($agent_rrd)) {
         rrdtool_create($agent_rrd, "DS:time:GAUGE:600:0:U " . $config['rrd_rra']);
     }
     rrdtool_update($agent_rrd, "N:" . $agent_time);
     $graphs['agent'] = TRUE;
     foreach (explode("<<<", $agent_raw) as $section) {
         list($section, $data) = explode(">>>", $section);
         list($sa, $sb, $sc) = explode("-", $section, 3);
         ## Compatibility with versions of scripts with and without app-
         ## Disabled for DRBD because it falsely detects the check_mk output
         if ($section == "apache") {
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:unix-agent.inc.php


示例13: htmlspecialchars

            $key = $value[2];
            $val = htmlspecialchars(stripslashes($pdef[$plkp[$key]]));
            if ($value[1]) {
                $checked = $val ? ' checked' : '';
            }
            eval('$opt="' . addslashes($templates[$value[1]][1]) . ($value[1] == 'tf' ? '' : '<br />') . '";');
            if ($value[1] != 'hidden') {
                tr($value[0], "&nbsp;{$opt}&nbsp;{$value['4']}", 1);
            } else {
                echo $opt;
            }
        }
    }
}
end_table();
?>
	<br />
	<center>
	<input name="action" type="hidden" value="submit" readonly>
	<input type="submit" name="Submit" value="Submit">
	&nbsp;&nbsp;&nbsp;
  <input type="reset" name="Reset" value="Reset">
	</center>
	</form>
<?php 
end_frame();
end_main_frame();
$pgt = utime() - $pgs;
echo "<center>Page Generated in {$pgt} Seconds</center>";
stdfoot();
die;
开发者ID:ZenoX2012,项目名称:CyBerFuN-CoDeX,代码行数:31,代码来源:core_.php


示例14: graph_error

    }
} else {
    #$rrd_options .= " HRULE:0#999999";
    if ($no_file) {
        if ($width < 200) {
            graph_error("无RRD");
        } else {
            graph_error("未找到 RRD数据文件");
        }
    } elseif (isset($vars['command_only']) && $vars['command_only'] == TRUE) {
        $graph_start = utime();
        $return = rrdtool_graph($graphfile, $rrd_options);
        $graph_end = utime();
        $graph_run = $graph_end - $graph_start;
        $graph_time = substr($graph_run, 0, 5);
        $total_end = utime();
        $total_run = $total_end - $total_start;
        $total_time = substr($total_run, 0, 5);
        unlink($graphfile);
        $graph_return['total_time'] = $total_time;
        $graph_return['rrdtool_time'] = $graph_time;
        $graph_return['cmd'] = "rrdtool graph {$graphfile} {$rrd_options}";
    } else {
        if ($rrd_options) {
            rrdtool_graph($graphfile, $rrd_options);
            if ($debug) {
                echo $rrd_cmd;
            }
            if (is_file($graphfile)) {
                if ($vars['image_data_uri'] == TRUE) {
                    $image_data_uri = data_uri($graphfile, 'image/png');
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:graph.inc.php


示例15: discover_device

function discover_device($device, $options = null)
{
    global $config, $valid;
    $valid = array();
    // Reset $valid array
    $attribs = get_dev_attribs($device['device_id']);
    $device_start = utime();
    // Start counting device poll time
    echo $device['hostname'] . ' ' . $device['device_id'] . ' ' . $device['os'] . ' ';
    if ($device['os'] == 'generic') {
        // verify if OS has changed from generic
        $device['os'] = getHostOS($device);
        if ($device['os'] != 'generic') {
            echo "\nDevice os was updated to " . $device['os'] . '!';
            dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id']));
        }
    }
    if ($config['os'][$device['os']]['group']) {
        $device['os_group'] = $config['os'][$device['os']]['group'];
        echo ' (' . $device['os_group'] . ')';
    }
    echo "\n";
    // If we've specified modules, use them, else walk the modules array
    if ($options['m']) {
        foreach (explode(',', $options['m']) as $module) {
            if (is_file("includes/discovery/{$module}.inc.php")) {
                include "includes/discovery/{$module}.inc.php";
            }
        }
    } else {
        foreach ($config['discovery_modules'] as $module => $module_status) {
            if ($attribs['discover_' . $module] || $module_status && !isset($attribs['discover_' . $module])) {
                include 'includes/discovery/' . $module . '.inc.php';
            } else {
                if (isset($attribs['discover_' . $module]) && $attribs['discover_' . $module] == '0') {
                    echo "Module [ {$module} ] disabled on host.\n";
                } else {
                    echo "Module [ {$module} ] disabled globally.\n";
                }
            }
        }
    }
    // Set type to a predefined type for the OS if it's not already set
    if ($device['type'] == 'unknown' || $device['type'] == '') {
        if ($config['os'][$device['os']]['type']) {
            $device['type'] = $config['os'][$device['os']]['type'];
        }
    }
    $device_end = utime();
    $device_run = $device_end - $device_start;
    $device_time = substr($device_run, 0, 5);
    dbUpdate(array('last_discovered' => array('NOW()'), 'type' => $device['type'], 'last_discovered_timetaken' => $device_time), 'devices', '`device_id` = ?', array($device['device_id']));
    echo "Discovered in {$device_time} seconds\n";
    global $discovered_devices;
    echo "\n";
    $discovered_devices++;
}
开发者ID:rkojedzinszky,项目名称:librenms,代码行数:57,代码来源:functions.inc.php


示例16: get_dev_attrib

    $ipmi['port'] = get_dev_attrib($device, 'ipmi_port');
    $ipmi['interface'] = get_dev_attrib($device, 'ipmi_interface');
    $ipmi['userlevel'] = get_dev_attrib($device, 'ipmi_userlevel');
    if (!is_numeric($ipmi['port'])) {
        $ipmi['port'] = 623;
    }
    if ($ipmi['userlevel'] == '') {
        $ipmi['userlevel'] = 'USER';
    }
    if (array_search($ipmi['interface'], array_keys($config['ipmi']['interfaces'])) === FALSE) {
        $ipmi['interface'] = 'lan';
    }
    // Also triggers on empty value
    if ($config['own_hostname'] != $device['hostname'] || $ipmi['host'] != 'localhost') {
        $remote = " -I " . escapeshellarg($ipmi['interface']) . " -p " . $ipmi['port'] . " -H " . escapeshellarg($ipmi['host']) . " -L " . escapeshellarg($ipmi['userlevel']) . " -U " . escapeshellarg($ipmi['user']) . " -P " . escapeshellarg($ipmi['password']);
    }
    $ipmi_start = utime();
    $results = external_exec($config['ipmitool'] . $remote . " sensor 2>/dev/null");
    $ipmi_end = utime();
    $ipmi_time = round(($ipmi_end - $ipmi_start) * 1000);
    echo '(' . $ipmi_time . 'ms) ';
    $ipmi_sensors = parse_ipmitool_sensor($device, $results);
}
if ($debug) {
    print_vars($ipmi_sensors);
}
foreach ($config['ipmi_unit'] as $type) {
    check_valid_sensors($device, $type, $ipmi_sensors, 'ipmi');
}
echo "\n";
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:ipmi.inc.php


示例17: dbFetchColumn

// Additional common counts
if ($config['enable_pseudowires']) {
    $cache['ports']['pseudowires'] = dbFetchColumn('SELECT DISTINCT `port_id` FROM `pseudowires` WHERE 1 ' . $cache['where']['ports_permitted']);
    $cache['pseudowires']['count'] = count($cache['ports']['pseudowires']);
}
if ($config['poller_modules']['cisco-cbqos'] || $config['discovery_modules']['cisco-cbqos']) {
    $cache['ports']['cbqos'] = dbFetchColumn('SELECT DISTINCT `port_id` FROM `ports_cbqos` WHERE 1 ' . $cache['where']['ports_permitted']);
    $cache['cbqos']['count'] = count($cache['ports']['cbqos']);
}
if ($config['poller_modules']['unix-agent']) {
    $cache['packages']['count'] = dbFetchCell("SELECT COUNT(*) FROM `packages` WHERE 1 " . $cache['where']['devices_permitted']);
}
if ($config['poller_modules']['applications']) {
    $cache['applications']['count'] = dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE 1 " . $cache['where']['devices_permitted']);
}
if ($config['poller_modules']['wifi'] || $config['discovery_modules']['wifi']) {
    $cache['wifi_sessions']['count'] = dbFetchCell("SELECT COUNT(*) FROM `wifi_sessions` WHERE 1 " . $cache['where']['devices_permitted']);
}
if ($config['poller_modules']['printersupplies'] || $config['discovery_modules']['printersupplies']) {
    $cache['printersupplies']['count'] = dbFetchCell("SELECT COUNT(*) FROM `printersupplies` WHERE 1 " . $cache['where']['devices_permitted']);
}
$cache['neighbours']['count'] = dbFetchCell("SELECT COUNT(*) FROM `neighbours` WHERE `active` = 1 " . $cache['where']['ports_permitted']);
$cache['sla']['count'] = dbFetchCell("SELECT COUNT(*) FROM `slas` WHERE `deleted` = 0 " . $cache['where']['devices_permitted']);
$cache['p2pradios']['count'] = dbFetchCell("SELECT COUNT(*) FROM `p2p_radios` WHERE `deleted` = 0 " . $cache['where']['devices_permitted']);
$cache['vm']['count'] = dbFetchCell("SELECT COUNT(*) FROM `vminfo` WHERE 1 " . $cache['where']['devices_permitted']);
$cache_time = utime() - $cache_start;
// Clean arrays (from DB queries)
unset($devices_array, $ports_array, $sensors_array, $status_array, $graphs_array, $device_graphs);
// Clean variables (generated by foreach)
unset($device, $port, $sensor, $status, $bgp, $ospf);
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:cache-data.inc.php


示例18: fclose

                                fclose($fd);
                            } else {
                                external_exec('/bin/ls -l ' . $graphfile);
                                echo '<img src="' . data_uri($graphfile, 'image/png') . '" alt="graph" />';
                            }
                        }
                        unlink($graphfile);
                    } else {
                        if ($width < 200) {
                            graph_error("Draw Error");
                        } else {
                            graph_error("Error Drawing Graph");
                        }
                    }
                } else {
                    if ($width < 200) {
                        graph_error("Def Error");
                    } else {
                        graph_error("Graph Definition Error");
                    }
                }
            }
        }
    }
}
// Total runtime and clean graph file
$graph_return['total'] = utime() - $total_start;
if (strlen($graph_return['filename']) && is_file($graph_return['filename'])) {
    unlink($graph_return['filename']);
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:graph.inc.php


示例19: spam_filter

 /**
  * Spam filter
  */
 private function spam_filter($text)
 {
     global $bb_cfg;
     static $spam_words = null;
     static $spam_replace = ' СПАМ';
     if (isset($this)) {
         $found_spam =& $this->found_spam;
     }
     // set $spam_words and $spam_replace
     if (!$bb_cfg['spam_filter_file_path']) {
         return $text;
     }
     if (is_null($spam_words)) {
         $spam_words = file_get_contents($bb_cfg['spam_filter_file_path']);
         $spam_words = strtolower($spam_words);
         $spam_words = explode("\n", $spam_words);
     }
     $found_spam = array();
     $tm_start = utime();
     $msg_decoded = $text;
     $msg_decoded = html_entity_decode($msg_decoded);
     $msg_decoded = urldecode($msg_decoded);
     $msg_decoded = str_replace('&', ' &', $msg_decoded);
     $msg_search = strtolower($msg_decoded);
     foreach ($spam_words as $spam_str) {
         if (!($spam_str = trim($spam_str))) {
             continue;
         }
         if (strpos($msg_search, $spam_str) !== false) {
             $found_spam[] = $spam_str;
         }
     }
     if ($found_spam) {
         $spam_exp = array();
         foreach ($found_spam as $keyword) {
             $spam_exp[] = preg_quote($keyword, '/');
         }
         $spam_exp = join('|', $spam_exp);
         $text = preg_replace("/({$spam_exp})(\\S*)/i", $spam_replace, $msg_decoded);
         $text = htmlCHR($text, false, ENT_NOQUOTES);
         #			bb_log(date("H:i:s") ." | ". sprintf('%.4f', (utime() - $tm_start)) ." | ". sprintf('%-6s', strlen($text)) ." | ". join(' ** ', $found_spam) ."\n", 'spam_filter');
     }
     return $text;
 }
开发者ID:ErR163,项目名称:torrentpier,代码行数:47,代码来源:bbcode.php


示例20: cache_alert_maintenance

if (isset($options['r'])) {
    $config['norrd'] = TRUE;
}
$cache['maint'] = cache_alert_maintenance();
rrdtool_pipe_open($rrd_process, $rrd_pipes);
print_cli_heading("%WStarting polling run at " . date("Y-m-d H:i:s"), 0);
$polled_devices = 0;
if (!isset($query)) {
    $query = "SELECT `device_id` FROM `devices` WHERE `disabled` = 0 {$where} ORDER BY `device_id` ASC";
}
foreach (dbFetch($query, $params) as $device) {
    $device = dbFetchRow("SELECT * FROM `devices` WHERE `device_id` = ?", array($device['device_id']));
    poll_device($device, $options);
    $polled_devices++;
}
$poller_end = utime();
$poller_run = $poller_end - $poller_start;
$poller_time = substr($poller_run, 0, 5);
if ($polled_devices) {
    dbInsert(array('type' => 'poll', 'doing' => $doing, 'start' => $poller_start, 'duration' => $poller_time, 'devices' => $polled_devices), 'perf_times');
    if (is_numeric($doing)) {
        $doing = $device['hostname'];
    }
    // Single device ID convert to hostname for log
} else {
    print_warning("WARNING: 0 devices polled. Did you specify a device that does not exist?");
}
$string = $argv[0] . ": {$doing} - {$polled_devices} devices polled in {$poller_time} secs";
print_debug($string);
print_cli_heading("%WCompleted polling run at " . date("Y-m-d H:i:s"), 0);
if (!isset($options['q'])) {
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:poller.php



注:本文中的utime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP uu_increment_username函数代码示例发布时间:2022-05-23
下一篇:
PHP utiliser_langue_visiteur函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap