Changeset 6692
- Timestamp:
- 10/02/08 11:39:19 (2 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/centreon/www/include/monitoring/external_cmd/functions.php
r6646 r6692 44 44 45 45 // Re-Schedule for all service of an host 46 47 46 function schedule_host_svc_checks($arg, $forced){ 48 47 global $pearDB; 48 $actions = false; 49 $actions = verifyActionsACLofUser("host_checks_for_services"); 50 51 if($actions == true) { 49 52 $tab_forced = array("0" => "", "1" => "_FORCED"); 50 53 $flg = write_command(" SCHEDULE".$tab_forced[$forced]."_HOST_SVC_CHECKS;" . $arg . ";" . time(), GetMyHostPoller($pearDB, $arg)); 51 54 return $flg; 55 } 56 57 return NULL; 52 58 } 53 59 54 60 // SCHEDULE_SVC_CHECK 55 56 61 function schedule_svc_checks($arg, $forced){ 57 62 global $pearDB; 63 $actions = false; 64 $actions = verifyActionsACLofUser("service_checks"); 65 66 if($actions == true) { 58 67 $tab_forced = array("0" => "", "1" => "_FORCED"); 59 68 $tab_data = split(";", $arg); 60 69 $flg = write_command(" SCHEDULE".$tab_forced[$forced]."_SVC_CHECK;". $tab_data[0] . ";" . $tab_data[1] . ";" . time(), GetMyHostPoller($pearDB, $tab_data[0])); 61 70 return _("Your command has been sent"); 71 } 72 73 return NULL; 62 74 } 63 75 64 76 // host check 65 66 77 function host_check($arg, $type){ 67 78 global $tab, $pearDB; 79 $actions = false; 80 $actions = verifyActionsACLofUser("host_checks"); 81 82 if($actions == true) { 68 83 $flg = write_command(" ". $tab[$type]."_HOST_CHECK;". $arg, GetMyHostPoller($pearDB, $arg)); 69 84 return _("Your command has been sent"); 85 } 86 87 return NULL; 70 88 } 71 89 … … 74 92 function host_notification($arg, $type){ 75 93 global $tab, $pearDB; 94 $actions = false; 95 $actions = verifyActionsACLofUser("host_notifications"); 96 97 if($actions == true) { 76 98 $flg = write_command(" ".$tab[$type]."_HOST_NOTIFICATIONS;". $arg, GetMyHostPoller($pearDB, $arg)); 77 99 return _("Your command has been sent"); 100 } 101 102 return NULL; 78 103 } 79 104 … … 82 107 function host_svc_notifications($arg, $type){ 83 108 global $tab, $pearDB; 109 $actions = false; 110 $actions = verifyActionsACLofUser("host_notifications_for_services"); 111 112 if ($actions == true) { 84 113 $flg = write_command(" " . $tab[$type] . "_HOST_SVC_NOTIFICATIONS;". $arg, GetMyHostPoller($pearDB, $arg)); 85 114 return _("Your command has been sent"); 115 } 116 117 return NULL; 86 118 } 87 119 … … 90 122 function host_svc_checks($arg, $type){ 91 123 global $tab, $pearDB; 92 $flg = write_command(" " . $tab[$type] . "_HOST_SVC_CHECKS;". $arg, GetMyHostPoller($pearDB, $arg)); 93 return _("Your command has been sent"); 124 $actions = false; 125 $actions = verifyActionsACLofUser("host_checks_for_services"); 126 127 if ($actions == true) { 128 $flg = write_command(" " . $tab[$type] . "_HOST_SVC_CHECKS;". $arg, GetMyHostPoller($pearDB, $arg)); 129 return _("Your command has been sent"); 130 } 131 132 return NULL; 94 133 } 95 134 … … 98 137 function svc_check($arg, $type){ 99 138 global $tab, $pearDB; 100 $tab_data = split(";", $arg); 101 $flg = write_command(" " . $tab[$type] . "_SVC_CHECK;". $tab_data["0"] .";".$tab_data["1"], GetMyHostPoller($pearDB, $tab_data["0"])); 102 return _("Your command has been sent"); 139 $actions = false; 140 $actions = verifyActionsACLofUser("host_checks"); 141 142 if ($actions == true) { 143 $tab_data = split(";", $arg); 144 $flg = write_command(" " . $tab[$type] . "_SVC_CHECK;". $tab_data["0"] .";".$tab_data["1"], GetMyHostPoller($pearDB, $tab_data["0"])); 145 return _("Your command has been sent"); 146 } 147 148 return NULL; 103 149 } 104 150 … … 107 153 function passive_svc_check($arg, $type){ 108 154 global $pearDB,$tab; 109 $tab_data = split(";", $arg); 110 $flg = write_command(" " . $tab[$type] . "_PASSIVE_SVC_CHECKS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 111 return _("Your command has been sent"); 155 $actions = false; 156 $actions = verifyActionsACLofUser("service_passive_checks"); 157 158 if ($actions == true) { 159 $tab_data = split(";", $arg); 160 $flg = write_command(" " . $tab[$type] . "_PASSIVE_SVC_CHECKS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 161 return _("Your command has been sent"); 162 } 163 164 return NULL; 112 165 } 113 166 … … 116 169 function svc_notifications($arg, $type){ 117 170 global $pearDB,$tab; 118 $tab_data = split(";", $arg); 119 $flg = write_command(" " . $tab[$type] . "_SVC_NOTIFICATIONS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 120 return _("Your command has been sent"); 171 $actions = false; 172 $actions = verifyActionsACLofUser("service_notifications"); 173 174 if ($actions == true) { 175 $tab_data = split(";", $arg); 176 $flg = write_command(" " . $tab[$type] . "_SVC_NOTIFICATIONS;". $tab_data[0] . ";". $tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 177 return _("Your command has been sent"); 178 } 179 return NULL; 121 180 } 122 181 … … 125 184 function svc_event_handler($arg, $type){ 126 185 global $pearDB,$tab; 186 $actions = false; 187 $actions = verifyActionsACLofUser("service_event_handler"); 188 189 if($actions == true) { 127 190 $tab_data = split(";", $arg); 128 191 $flg = write_command(" " . $tab[$type] . "_SVC_EVENT_HANDLER;". $tab_data[0] .";".$tab_data[1], GetMyHostPoller($pearDB, $tab_data["0"])); 129 192 return _("Your command has been sent"); 193 } 194 195 return NULL; 130 196 } 131 197 … … 134 200 function host_event_handler($arg, $type){ 135 201 global $pearDB,$tab; 202 $actions = false; 203 $actions = verifyActionsACLofUser("host_event_handler"); 204 205 if($actions == true) { 136 206 $tab_data = split(";", $arg); 137 207 $flg = write_command(" " . $tab[$type] . "_HOST_EVENT_HANDLER;". $arg, GetMyHostPoller($pearDB, $arg)); 138 208 return _("Your command has been sent"); 209 } 210 211 return NULL; 139 212 } 140 213 141 214 //_SVC_FLAP_DETECTION 142 143 215 function svc_flapping_enable($arg, $type){ 144 216 global $pearDB,$tab; 217 $actions = false; 218 $actions = verifyActionsACLofUser("service_flap_detection"); 219 220 if($actions == true) { 145 221 $tab_data = split(";", $arg); 146 222 $flg = write_command(" " . $tab[$type] . "_SVC_FLAP_DETECTION;". $tab_data[0] .";".$tab_data[1], GetMyHostPoller($pearDB, $tab_data[0])); 147 223 return _("Your command has been sent"); 224 } 225 return NULL; 148 226 } 149 227 150 228 //_HOST_FLAP_DETECTION 151 152 229 function host_flapping_enable($arg, $type){ 153 230 global $pearDB,$tab; 231 $actions = false; 232 $actions = verifyActionsACLofUser("host_flap_detection"); 233 234 if($actions == true) { 154 235 $tab_data = split(";", $arg); 155 236 $flg = write_command(" " . $tab[$type] . "_HOST_FLAP_DETECTION;". $arg, GetMyHostPoller($pearDB, $arg)); 156 237 return _("Your command has been sent"); 238 } 239 240 return NULL; 157 241 } 158 242 … … 166 250 function acknowledgeHost(){ 167 251 global $pearDB,$tab, $_GET, $key; 252 $actions = false; 253 $actions = verifyActionsACLofUser("host_acknowledgement"); 254 255 if ($actions == true) { 168 256 $key = $_GET["host_name"]; 169 257 $flg = write_command(" ACKNOWLEDGE_HOST_PROBLEM;".$_GET["host_name"].";1;".$_GET["notify"].";".$_GET["persistent"].";".$_GET["author"].";".$_GET["comment"], GetMyHostPoller($pearDB, $_GET["host_name"])); 170 258 return _("Your command has been sent"); 259 } 260 261 return NULL; 171 262 } 172 263 173 264 function acknowledgeHostDisable(){ 174 265 global $pearDB,$tab, $_GET; 266 $actions = false; 267 $actions = verifyActionsACLofUser("host_acknowledgement"); 268 269 if ($actions == true) { 175 270 $flg = write_command(" REMOVE_HOST_ACKNOWLEDGEMENT;".$_GET["host_name"], GetMyHostPoller($pearDB, $_GET["host_name"])); 176 271 return _("Your command has been sent"); 272 } 273 274 return NULL; 177 275 } 178 276 179 277 function acknowledgeServiceDisable(){ 180 278 global $pearDB,$tab; 279 $actions = false; 280 $actions = verifyActionsACLofUser("service_acknowledgement"); 281 282 if ($actions == true) { 181 283 $flg = write_command(" REMOVE_SVC_ACKNOWLEDGEMENT;".$_GET["host_name"].";".$_GET["service_description"], GetMyHostPoller($pearDB, $_GET["host_name"])); 182 284 return _("Your command has been sent"); 285 } 286 287 return NULL; 183 288 } 184 289 185 290 function acknowledgeService(){ 186 291 global $pearDB,$tab; 292 $actions = false; 293 $actions = verifyActionsACLofUser("service_acknowledgement"); 294 295 if ($actions == true) { 187 296 $_GET["comment"] = htmlentities($_GET["comment"]); 188 297 $_GET["comment"] = str_replace('\'', ' ', $_GET["comment"]); 189 298 $flg = write_command(" ACKNOWLEDGE_SVC_PROBLEM;".$_GET["host_name"].";".$_GET["service_description"].";1;".$_GET["notify"].";".$_GET["persistent"].";".$_GET["author"].";".$_GET["comment"], GetMyHostPoller($pearDB, $_GET["host_name"])); 190 299 return _("Your command has been sent"); 300 } 301 302 return NULL; 191 303 } 192 304 193 305 function submitPassiveCheck(){ 194 306 global $pearDB, $key; 307 $actions = false; 308 $actions = verifyActionsACLofUser("service_submit_result"); 309 310 if ($actions == true) { 195 311 $key = $_GET["host_name"]; 196 312 $flg = write_command(" PROCESS_SERVICE_CHECK_RESULT;".$_GET["host_name"].";".$_GET["service_description"].";".$_GET["return_code"].";".$_GET["output"]."|".$_GET["dataPerform"], GetMyHostPoller($pearDB, $_GET["host_name"])); 197 313 return _("Your command has been sent"); 314 } 315 316 return NULL; 198 317 } 199 318
