$oMProduct->updateField($monType_id, $monitor_values); } else { insert_query('tblcustomfields', $monitor_values); } if ($_POST['edit_type'] == 'create') { $oMProduct->activateProduct($productId, $new_setting); MonitisApp::addMessage('Product "' . $_POST["productName"] . '" activated successfully'); } else { $oMProduct->updateProduct($productId, $new_setting); MonitisApp::addMessage('Product "' . $_POST["productName"] . '" updated successfully'); } } else { MonitisApp::addError('Monitor type is required'); } } elseif ($action) { $productIds = monitisPost('productIds'); if ($productIds) { switch ($action) { case 'activate': $resp = $oMProduct->activateProducts($productIds); if ($resp['status'] == 'ok') { $prdcts = $resp['products']; for ($i = 0; $i < count($prdcts); $i++) { if ($prdcts[$i]['status'] == 'error') { MonitisApp::addError($prdcts[$i]['msg']); } elseif ($prdcts[$i]['status'] == 'warning') { //MonitisApp::addWarning($prdcts[$i]['msg']); } else { //MonitisApp::addMessage($prdcts[$i]['msg']); } }
if ($productIds) { for ($i = 0; $i < count($productIds); $i++) { $monitor_type = 'http'; $setting = MonitisConf::$settings[$monitor_type]; $oAddon->updateAddonSettings($productIds[$i], json_encode($setting), $monitor_type); } } break; case 'deactivate': if ($productIds) { $ids = implode(',', $productIds); $oAddon->deactivateAddon($ids); } break; case 'automate': $productId = monitisPost('productId'); header('location: ' . MONITIS_APP_URL . '&monitis_page=client/addonsresult&addonid=' . $productId); break; } } $products = $oAddon->addonsList(); MonitisApp::printNotifications(); ?> <table width="100%" border="0" cellpadding="3" cellspacing="0"> <tr> <td width="50%" align="left"> <b><?php echo count($products); ?> </b> Addons Found, Page <b>1</b> of <b>1</b> </td>
<form action="" method="post"> <table class="form" width="100%" border=0 cellspacing=2 cellpadding=3> <tr> <td class="fieldlabel">API Key</td> <td class="fieldarea"> <input type="text" name="apiKey" size="40" value="<?php echo monitisPost('apiKey', MonitisConf::$apiKey); ?> " /> </td> </tr> <tr> <td class="fieldlabel">Secret Key</td> <td class="fieldarea"> <input type="text" name="secretKey" size="40" value="<?php echo monitisPost('secretKey', MonitisConf::$secretKey); ?> " /> </td> </tr> <tr> <td class="fieldlabel"></td> <td class="fieldarea1"> <input type="submit" value="Save" class="btn monitis_link_button" /> <input type="hidden" name="monitisFormSubmitted" value="1" /> <input type="hidden" name="monitisTimeZone" class="monitisTimeZone" value="1" /> </td> </tr> </table> </form> </center>
"OPENSOLARIS":{"usedMax":"n","kernelMax":"n"} }'); define('MONITIS_MEMORY_MONITOR_PROPS_TPL', '{ "LINUX":{"freeLimit":"n","freeSwapLimit":"n","bufferedLimit":"n","cachedLimit":"n"}, "WINDOWS":{"freeLimit":"n","freeSwapLimit":"n","freeVirtualLimit":"n"}, "OPENSOLARIS":{"freeLimit":"n","freeSwapLimit":"n"} }'); $isNewAcc = monitisGetInt('isNewAcc'); $locations = MonitisConf::$locations; $newAgentPlatform = MonitisConf::$newAgentPlatform; $old_ping = MonitisConf::$settings['ping']; $old_cpu = MonitisConf::$settings['cpu'][$newAgentPlatform]; $old_memory = MonitisConf::$settings['memory'][$newAgentPlatform]; $old_drive = MonitisConf::$settings['drive']; $locationIds = $old_ping['locationIds']; $action_type = monitisPost('action_type'); if ($action_type == 'saveConfig') { if (isset($_POST['locationIDs']) && !empty($_POST['locationIDs'])) { $arr = $_POST['locationIDs']; $locationIds = array_map("intval", $arr); } $platform = $_POST['agentPlatform']; $newsets = MonitisConf::$settings; // PING monitor settings $newsets['ping']['interval'] = isset($_POST['interval']) ? intval($_POST['interval']) : $old_ping['interval']; $newsets['ping']['timeout'] = isset($_POST['timeout']) ? intval($_POST['timeout']) : $old_ping['timeout']; $newsets['ping']['locationIds'] = $locationIds; // CPU monitor settings $tpl = json_decode(MONITIS_CPU_MONITOR_PROPS_TPL, true); foreach ($tpl[$platform] as $key => $val) { $newsets['cpu'][$platform][$key] = isset($_POST[$key]) ? intval($_POST[$key]) : $old_cpu[$key];