コード例 #1
0
}
// the way that munin wildcard plugins work is that many symlinks are created to the
// plugin, appending graph name to the original plugin file name. The shell script
// will pass us its own filename in the 'variable' option
$variable = isset($options['variable']) ? $options['variable'] : '';
$variable = preg_replace('/^ezmuninperflogger_/', '', $variable);
// default munin range: 5 minutes
$range = $options['range'] ? $options['range'] : 60 * 5;
$ini = eZINI::instance('ezperformancelogger.ini');
switch ($command) {
    case 'autoconf':
        // This command is called by munin to know if all config needed by this plugin has been done right.
        // If the php script can actually run succesfully, this means it has (config is needed to tell
        // Munin where php is and where this script is)
        $siteIni = eZINI::instance();
        if (!eZPerfLogger::isEnabled()) {
            $cli->output("no (extension ezperformancelogger not enabled)");
            $script->shutdown();
        }
        if (!in_array('csv', $ini->variable('GeneralSettings', 'LogMethods'))) {
            $cli->output("no (extension ezperformancelogger is not logging data to csv log files)");
            $script->shutdown();
        }
        $cli->output("yes");
        $script->shutdown();
        break;
    case 'suggest':
        // This command is called by munin to get a list of graphs that this plugin supports
        // See http://munin-monitoring.org/wiki/ConcisePlugins
        foreach (array_merge($ini->variable('GeneralSettings', 'TrackVariables'), array('pageviews')) as $var) {
            echo "{$var}\n";