本文整理汇总了PHP中PluginMonitoringProfile::initProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginMonitoringProfile::initProfile方法的具体用法?PHP PluginMonitoringProfile::initProfile怎么用?PHP PluginMonitoringProfile::initProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginMonitoringProfile
的用法示例。
在下文中一共展示了PluginMonitoringProfile::initProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pluginMonitoringInstall
function pluginMonitoringInstall($version)
{
global $DB, $LANG, $CFG_GLPI;
// ** Insert in DB
$DB_file = GLPI_ROOT . "/plugins/monitoring/install/mysql/plugin_monitoring-" . $version . "-empty.sql";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (get_magic_quotes_runtime()) {
$sql_line = stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
include GLPI_ROOT . "/plugins/monitoring/inc/profile.class.php";
$pmProfile = new PluginMonitoringProfile();
$pmProfile->initProfile();
include GLPI_ROOT . "/plugins/monitoring/inc/command.class.php";
$pmCommand = new PluginMonitoringCommand();
$pmCommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/notificationcommand.class.php";
$pmNotificationcommand = new PluginMonitoringNotificationcommand();
$pmNotificationcommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/check.class.php";
$pmCheck = new PluginMonitoringCheck();
$pmCheck->initChecks();
include GLPI_ROOT . "/plugins/monitoring/inc/hostconfig.class.php";
$pmHostconfig = new PluginMonitoringHostconfig();
$pmHostconfig->initConfig();
include GLPI_ROOT . "/plugins/monitoring/inc/config.class.php";
$pmConfig = new PluginMonitoringConfig();
$pmConfig->initConfig();
$query = "UPDATE `glpi_plugin_monitoring_configs`\n SET `version`='" . PLUGIN_MONITORING_VERSION . "'\n WHERE `id`='1'";
$DB->query($query);
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/templates')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/templates");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/weathermapbg')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/weathermapbg");
}
CronTask::Register('PluginMonitoringServiceevent', 'updaterrd', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringLog', 'cleanlogs', '96400', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringUnavaibility', 'unavaibility', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
示例2: pluginMonitoringInstall
function pluginMonitoringInstall($version)
{
global $DB, $CFG_GLPI;
// ** Insert in DB
$DB_file = GLPI_ROOT . "/plugins/monitoring/install/mysql/plugin_monitoring-" . $version . "-empty.sql";
$DBf_handle = fopen($DB_file, "rt");
$sql_query = fread($DBf_handle, filesize($DB_file));
fclose($DBf_handle);
foreach (explode(";\n", "{$sql_query}") as $sql_line) {
if (get_magic_quotes_runtime()) {
$sql_line = Toolbox::stripslashes_deep($sql_line);
}
if (!empty($sql_line)) {
$DB->query($sql_line);
}
}
include GLPI_ROOT . "/plugins/monitoring/inc/profile.class.php";
$pmProfile = new PluginMonitoringProfile();
$pmProfile->initProfile();
include GLPI_ROOT . "/plugins/monitoring/inc/command.class.php";
$pmCommand = new PluginMonitoringCommand();
$pmCommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/notificationcommand.class.php";
$pmNotificationcommand = new PluginMonitoringNotificationcommand();
$pmNotificationcommand->initCommands();
include GLPI_ROOT . "/plugins/monitoring/inc/check.class.php";
$pmCheck = new PluginMonitoringCheck();
$pmCheck->initChecks();
include GLPI_ROOT . "/plugins/monitoring/inc/hostconfig.class.php";
$pmHostconfig = new PluginMonitoringHostconfig();
$pmHostconfig->initConfig();
include GLPI_ROOT . "/plugins/monitoring/inc/config.class.php";
$pmConfig = new PluginMonitoringConfig();
$pmConfig->initConfig();
$query = "UPDATE `glpi_plugin_monitoring_configs`\n SET `version`='" . PLUGIN_MONITORING_VERSION . "'\n WHERE `id`='1'";
$DB->query($query);
$query = "SELECT * FROM `glpi_calendars`\n WHERE `name`='24x7'\n LIMIT 1";
$result = $DB->query($query);
if ($DB->numrows($result) == 0) {
$calendar = new Calendar();
$input = array();
$input['name'] = '24x7';
$input['is_recursive'] = 1;
$calendars_id = $calendar->add($input);
$calendarSegment = new CalendarSegment();
$input = array();
$input['calendars_id'] = $calendars_id;
$input['is_recursive'] = 1;
$input['begin'] = '00:00:00';
$input['end'] = '24:00:00';
$input['day'] = '0';
$calendarSegment->add($input);
$input['day'] = '1';
$calendarSegment->add($input);
$input['day'] = '2';
$calendarSegment->add($input);
$input['day'] = '3';
$calendarSegment->add($input);
$input['day'] = '4';
$calendarSegment->add($input);
$input['day'] = '5';
$calendarSegment->add($input);
$input['day'] = '6';
$calendarSegment->add($input);
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/templates')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/templates");
}
if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/monitoring/weathermapbg')) {
mkdir(GLPI_PLUGIN_DOC_DIR . "/monitoring/weathermapbg");
}
CronTask::Register('PluginMonitoringServiceevent', 'updaterrd', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringLog', 'cleanlogs', '96400', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringUnavaibility', 'unavaibility', '300', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
CronTask::Register('PluginMonitoringDisplayview_rule', 'replayallviewrules', '1200', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}