| | 637 | /* |
| | 638 | * Logs |
| | 639 | */ |
| | 640 | $fields["command_command_id"] = $ret["command_command_id"]; |
| | 641 | $fields["command_command_id_arg1"] = $ret["command_command_id_arg1"]; |
| | 642 | $fields["timeperiod_tp_id"] = $ret["timeperiod_tp_id"]; |
| | 643 | $fields["timeperiod_tp_id2"] = $ret["timeperiod_tp_id2"]; |
| | 644 | $fields["command_command_id2"] = $ret["command_command_id2"]; |
| | 645 | $fields["command_command_id_arg2"] = $ret["command_command_id_arg2"]; |
| | 646 | $fields["host_name"] = htmlentities($ret["host_name"], ENT_QUOTES); |
| | 647 | $fields["host_alias"] = htmlentities($ret["host_alias"], ENT_QUOTES); |
| | 648 | $fields["host_address"] = htmlentities($ret["host_address"], ENT_QUOTES); |
| | 649 | $fields["host_max_check_attempts"] = $ret["host_max_check_attempts"]; |
| | 650 | $fields["host_check_interval"] = $ret["host_check_interval"]; |
| | 651 | $fields["host_active_checks_enabled"] = $ret["host_active_checks_enabled"]["host_active_checks_enabled"]; |
| | 652 | $fields["host_passive_checks_enabled"] = $ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]; |
| | 653 | $fields["host_checks_enabled"] = $ret["host_checks_enabled"]["host_checks_enabled"]; |
| | 654 | $fields["host_obsess_over_host"] = $ret["host_obsess_over_host"]["host_obsess_over_host"]; |
| | 655 | $fields["host_check_freshness"] = $ret["host_check_freshness"]["host_check_freshness"]; |
| | 656 | $fields["host_freshness_threshold"] = $ret["host_freshness_threshold"]; |
| | 657 | $fields["host_event_handler_enabled"] = $ret["host_event_handler_enabled"]["host_event_handler_enabled"]; |
| | 658 | $fields["host_low_flap_threshold"] = $ret["host_low_flap_threshold"]; |
| | 659 | $fields["host_high_flap_threshold"] = $ret["host_high_flap_threshold"]; |
| | 660 | $fields["host_flap_detection_enabled"] = $ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]; |
| | 661 | $fields["host_process_perf_data"] = $ret["host_process_perf_data"]["host_process_perf_data"]; |
| | 662 | $fields["host_retain_status_information"] = $ret["host_retain_status_information"]["host_retain_status_information"]; |
| | 663 | $fields["host_retain_nonstatus_information"] = $ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]; |
| | 664 | $fields["host_notification_interval"] = $ret["host_notification_interval"]; |
| | 665 | $fields["host_notifOpts"] = ""; |
| | 666 | if (isset($ret["host_notifOpts"])) |
| | 667 | $fields["host_notifOpts"] = implode(",", $ret["host_notifOpts"]); |
| | 668 | $fields["host_notifications_enabled"] = $ret["host_notifications_enabled"]["host_notifications_enabled"]; |
| | 669 | $fields["host_first_notification_delay"] = $ret["host_first_notification_delay"]; |
| | 670 | $fields["host_stalOpts"] = ""; |
| | 671 | if (isset($ret["host_stalOpts"])) |
| | 672 | $fields["host_stalOpts"] = implode(",", $ret["host_stalOpts"]); |
| | 673 | $fields["host_snmp_community"] = htmlentities($ret["host_snmp_community"], ENT_QUOTES); |
| | 674 | $fields["host_snmp_version"] = htmlentities($ret["host_snmp_version"], ENT_QUOTES); |
| | 675 | $fields["host_location"] = htmlentities($ret["host_location"], ENT_QUOTES); |
| | 676 | $fields["host_comment"] = htmlentities($ret["host_comment"], ENT_QUOTES); |
| | 677 | $fields["host_register"] = $ret["host_register"]["host_register"]; |
| | 678 | $fields["host_activate"] = $ret["host_activate"]["host_activate"]; |
| | 679 | $fields["templates"] = $multiTP_logStr; |
| | 680 | $fields["ehi_notes"] = htmlentities($ret["ehi_notes"], ENT_QUOTES); |
| | 681 | $fields["ehi_notes_url"] = htmlentities($ret["ehi_notes_url"], ENT_QUOTES); |
| | 682 | $fields["ehi_action_url"] = htmlentities($ret["ehi_action_url"], ENT_QUOTES); |
| | 683 | $fields["ehi_icon_image"] = htmlentities($ret["ehi_icon_image"], ENT_QUOTES); |
| | 684 | $fields["ehi_icon_image_alt"] = htmlentities($ret["ehi_icon_image_alt"], ENT_QUOTES); |
| | 685 | $fields["ehi_vrml_image"] = htmlentities($ret["ehi_vrml_image"], ENT_QUOTES); |
| | 686 | $fields["ehi_statusmap_image"] = htmlentities($ret["ehi_statusmap_image"], ENT_QUOTES); |
| | 687 | $fields["ehi_2d_coords"] = htmlentities($ret["ehi_2d_coords"], ENT_QUOTES); |
| | 688 | $fields["ehi_3d_coords"] = htmlentities($ret["ehi_3d_coords"], ENT_QUOTES); |
| | 689 | $fields["host_parents"] = ""; |
| | 690 | if (isset($ret["host_parents"])) |
| | 691 | $fields["host_parents"] = implode(",", $ret["host_parents"]); |
| | 692 | $fields["host_childs"] = ""; |
| | 693 | if (isset($ret["host_childs"])) |
| | 694 | $fields["host_childs"] = implode(",", $ret["host_childs"]); |
| | 695 | $fields["host_cgs"] = ""; |
| | 696 | if (isset($ret["host_cgs"])) |
| | 697 | $fields["host_cgs"] = implode(",", $ret["host_cgs"]); |
| | 698 | $fields["host_cs"] = ""; |
| | 699 | if (isset($ret["host_cs"])) |
| | 700 | $fields["host_cs"] = implode(",", $ret["host_cs"]); |
| | 701 | $fields["host_svTpls"] = ""; |
| | 702 | if (isset($ret["host_svTpls"])) |
| | 703 | $fields["host_svTpls"] = implode(",", $ret["host_svTpls"]); |
| | 704 | $fields["nagios_server_id"] = ""; |
| | 705 | if (isset($ret["nagios_server_id"])) |
| | 706 | $fields["nagios_server_id"] = $ret["nagios_server_id"]; |
| | 707 | $oreon->CentreonLogAction->insertLog("host", $host_id["MAX(host_id)"], htmlentities($ret["host_name"], ENT_QUOTES), "a", $fields); |
| | 1047 | |
| | 1048 | /* |
| | 1049 | * Logs |
| | 1050 | */ |
| | 1051 | $fields["command_command_id"] = $ret["command_command_id"]; |
| | 1052 | $fields["command_command_id_arg1"] = $ret["command_command_id_arg1"]; |
| | 1053 | $fields["timeperiod_tp_id"] = $ret["timeperiod_tp_id"]; |
| | 1054 | $fields["timeperiod_tp_id2"] = $ret["timeperiod_tp_id2"]; |
| | 1055 | $fields["command_command_id2"] = $ret["command_command_id2"]; |
| | 1056 | $fields["command_command_id_arg2"] = $ret["command_command_id_arg2"]; |
| | 1057 | $fields["host_name"] = htmlentities($ret["host_name"], ENT_QUOTES); |
| | 1058 | $fields["host_alias"] = htmlentities($ret["host_alias"], ENT_QUOTES); |
| | 1059 | $fields["host_address"] = htmlentities($ret["host_address"], ENT_QUOTES); |
| | 1060 | $fields["host_max_check_attempts"] = $ret["host_max_check_attempts"]; |
| | 1061 | $fields["host_check_interval"] = $ret["host_check_interval"]; |
| | 1062 | $fields["host_active_checks_enabled"] = $ret["host_active_checks_enabled"]["host_active_checks_enabled"]; |
| | 1063 | $fields["host_passive_checks_enabled"] = $ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]; |
| | 1064 | $fields["host_checks_enabled"] = $ret["host_checks_enabled"]["host_checks_enabled"]; |
| | 1065 | $fields["host_obsess_over_host"] = $ret["host_obsess_over_host"]["host_obsess_over_host"]; |
| | 1066 | $fields["host_check_freshness"] = $ret["host_check_freshness"]["host_check_freshness"]; |
| | 1067 | $fields["host_freshness_threshold"] = $ret["host_freshness_threshold"]; |
| | 1068 | $fields["host_event_handler_enabled"] = $ret["host_event_handler_enabled"]["host_event_handler_enabled"]; |
| | 1069 | $fields["host_low_flap_threshold"] = $ret["host_low_flap_threshold"]; |
| | 1070 | $fields["host_high_flap_threshold"] = $ret["host_high_flap_threshold"]; |
| | 1071 | $fields["host_flap_detection_enabled"] = $ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]; |
| | 1072 | $fields["host_process_perf_data"] = $ret["host_process_perf_data"]["host_process_perf_data"]; |
| | 1073 | $fields["host_retain_status_information"] = $ret["host_retain_status_information"]["host_retain_status_information"]; |
| | 1074 | $fields["host_retain_nonstatus_information"] = $ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]; |
| | 1075 | $fields["host_notification_interval"] = $ret["host_notification_interval"]; |
| | 1076 | $fields["host_notifOpts"] = ""; |
| | 1077 | if (isset($ret["host_notifOpts"])) |
| | 1078 | $fields["host_notifOpts"] = implode(",", $ret["host_notifOpts"]); |
| | 1079 | $fields["host_notifications_enabled"] = $ret["host_notifications_enabled"]["host_notifications_enabled"]; |
| | 1080 | $fields["host_first_notification_delay"] = $ret["host_first_notification_delay"]; |
| | 1081 | $fields["host_stalOpts"] = ""; |
| | 1082 | if (isset($ret["host_stalOpts"])) |
| | 1083 | $fields["host_stalOpts"] = implode(",", $ret["host_stalOpts"]); |
| | 1084 | $fields["host_snmp_community"] = htmlentities($ret["host_snmp_community"], ENT_QUOTES); |
| | 1085 | $fields["host_snmp_version"] = htmlentities($ret["host_snmp_version"], ENT_QUOTES); |
| | 1086 | $fields["host_location"] = htmlentities($ret["host_location"], ENT_QUOTES); |
| | 1087 | $fields["host_comment"] = htmlentities($ret["host_comment"], ENT_QUOTES); |
| | 1088 | $fields["host_register"] = $ret["host_register"]["host_register"]; |
| | 1089 | $fields["host_activate"] = $ret["host_activate"]["host_activate"]; |
| | 1090 | $fields["templates"] = $multiTP_logStr; |
| | 1091 | $fields["ehi_notes"] = htmlentities($ret["ehi_notes"], ENT_QUOTES); |
| | 1092 | $fields["ehi_notes_url"] = htmlentities($ret["ehi_notes_url"], ENT_QUOTES); |
| | 1093 | $fields["ehi_action_url"] = htmlentities($ret["ehi_action_url"], ENT_QUOTES); |
| | 1094 | $fields["ehi_icon_image"] = htmlentities($ret["ehi_icon_image"], ENT_QUOTES); |
| | 1095 | $fields["ehi_icon_image_alt"] = htmlentities($ret["ehi_icon_image_alt"], ENT_QUOTES); |
| | 1096 | $fields["ehi_vrml_image"] = htmlentities($ret["ehi_vrml_image"], ENT_QUOTES); |
| | 1097 | $fields["ehi_statusmap_image"] = htmlentities($ret["ehi_statusmap_image"], ENT_QUOTES); |
| | 1098 | $fields["ehi_2d_coords"] = htmlentities($ret["ehi_2d_coords"], ENT_QUOTES); |
| | 1099 | $fields["ehi_3d_coords"] = htmlentities($ret["ehi_3d_coords"], ENT_QUOTES); |
| | 1100 | $fields["host_parents"] = ""; |
| | 1101 | if (isset($ret["host_parents"])) |
| | 1102 | $fields["host_parents"] = implode(",", $ret["host_parents"]); |
| | 1103 | $fields["host_childs"] = ""; |
| | 1104 | if (isset($ret["host_childs"])) |
| | 1105 | $fields["host_childs"] = implode(",", $ret["host_childs"]); |
| | 1106 | $fields["host_cgs"] = ""; |
| | 1107 | if (isset($ret["host_cgs"])) |
| | 1108 | $fields["host_cgs"] = implode(",", $ret["host_cgs"]); |
| | 1109 | $fields["host_cs"] = ""; |
| | 1110 | if (isset($ret["host_cs"])) |
| | 1111 | $fields["host_cs"] = implode(",", $ret["host_cs"]); |
| | 1112 | $fields["host_svTpls"] = ""; |
| | 1113 | if (isset($ret["host_svTpls"])) |
| | 1114 | $fields["host_svTpls"] = implode(",", $ret["host_svTpls"]); |
| | 1115 | $fields["nagios_server_id"] = ""; |
| | 1116 | if (isset($ret["nagios_server_id"])) |
| | 1117 | $fields["nagios_server_id"] = $ret["nagios_server_id"]; |
| | 1118 | $oreon->CentreonLogAction->insertLog("host", $host_id, htmlentities($ret["host_name"], ENT_QUOTES), "c", $fields); |
| 953 | | if (isset($ret["host_template_model_htm_id"]) && $ret["host_template_model_htm_id"] != NULL) $rq .= "host_template_model_htm_id = '".$ret["host_template_model_htm_id"]."', "; |
| 954 | | if (isset($ret["command_command_id"]) && $ret["command_command_id"] != NULL) $rq .= "command_command_id = '".$ret["command_command_id"]."', "; |
| 955 | | if (isset($ret["command_command_id_arg1"]) && $ret["command_command_id_arg1"] != NULL) $rq .= "command_command_id_arg1 = '".$ret["command_command_id_arg1"]."', "; |
| 956 | | if (isset($ret["timeperiod_tp_id"]) && $ret["timeperiod_tp_id"] != NULL) $rq .= "timeperiod_tp_id = '".$ret["timeperiod_tp_id"]."', "; |
| 957 | | if (isset($ret["timeperiod_tp_id2"]) && $ret["timeperiod_tp_id2"] != NULL) $rq .= "timeperiod_tp_id2 = '".$ret["timeperiod_tp_id2"]."', "; |
| 958 | | if (isset($ret["command_command_id2"]) && $ret["command_command_id2"] != NULL) $rq .= "command_command_id2 = '".$ret["command_command_id2"]."', "; |
| 959 | | if (isset($ret["command_command_id_arg2"]) && $ret["command_command_id_arg2"] != NULL) $rq .= "command_command_id_arg2 = '".$ret["command_command_id_arg2"]."', "; |
| 960 | | if (isset($ret["host_address"]) && $ret["host_address"] != NULL) $rq .= "host_address = '".htmlentities($ret["host_address"], ENT_QUOTES)."', "; |
| 961 | | if (isset($ret["host_max_check_attempts"]) && $ret["host_max_check_attempts"] != NULL) $rq .= "host_max_check_attempts = '".$ret["host_max_check_attempts"]."', " ; |
| 962 | | if (isset($ret["host_check_interval"]) && $ret["host_check_interval"]!= NULL) $rq .= "host_check_interval = '".$ret["host_check_interval"]."', "; |
| 963 | | if (isset($ret["host_active_checks_enabled"]["host_active_checks_enabled"])) $rq .= "host_active_checks_enabled = '".$ret["host_active_checks_enabled"]["host_active_checks_enabled"]."', "; |
| 964 | | if (isset($ret["host_passive_checks_enabled"]["host_passive_checks_enabled"])) $rq .= "host_passive_checks_enabled = '".$ret["host_passive_checks_enabled"]["host_passive_checks_enabled"]."', "; |
| 965 | | if (isset($ret["host_checks_enabled"]["host_checks_enabled"])) $rq .= "host_checks_enabled = '".$ret["host_checks_enabled"]["host_checks_enabled"]."', "; |
| 966 | | if (isset($ret["host_obsess_over_host"]["host_obsess_over_host"])) $rq .= "host_obsess_over_host = '".$ret["host_obsess_over_host"]["host_obsess_over_host"]."', "; |
| 967 | | if (isset($ret["host_check_freshness"]["host_check_freshness"])) $rq .= "host_check_freshness = '".$ret["host_check_freshness"]["host_check_freshness"]."', "; |
| 968 | | if (isset($ret["host_freshness_threshold"]) && $ret["host_freshness_threshold"] != NULL) $rq .= "host_freshness_threshold = '".$ret["host_freshness_threshold"]."', "; |
| 969 | | if (isset($ret["host_event_handler_enabled"]["host_event_handler_enabled"])) $rq .= "host_event_handler_enabled = '".$ret["host_event_handler_enabled"]["host_event_handler_enabled"]."', "; |
| 970 | | if (isset($ret["host_low_flap_threshold"]) && $ret["host_low_flap_threshold"]!= NULL) $rq .= "host_low_flap_threshold = '".$ret["host_low_flap_threshold"]."', "; |
| 971 | | if (isset($ret["host_high_flap_threshold"]) && $ret["host_high_flap_threshold"] != NULL) $rq .= "host_high_flap_threshold = '".$ret["host_high_flap_threshold"]."', "; |
| 972 | | if (isset($ret["host_flap_detection_enabled"]["host_flap_detection_enabled"])) $rq .= "host_flap_detection_enabled = '".$ret["host_flap_detection_enabled"]["host_flap_detection_enabled"]."', "; |
| 973 | | if (isset($ret["host_process_perf_data"]["host_process_perf_data"])) $rq .= "host_process_perf_data = '".$ret["host_process_perf_data"]["host_process_perf_data"]."', "; |
| 974 | | if (isset($ret["host_retain_status_information"]["host_retain_status_information"])) $rq .= "host_retain_status_information = '".$ret["host_retain_status_information"]["host_retain_status_information"]."', "; |
| 975 | | if (isset($ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"])) $rq .= "host_retain_nonstatus_information = '".$ret["host_retain_nonstatus_information"]["host_retain_nonstatus_information"]."', "; |
| 976 | | if (isset($ret["host_notification_interval"]) && $ret["host_notification_interval"] != NULL) $rq .= "host_notification_interval = '".$ret["host_notification_interval"]."', "; |
| 977 | | if (isset($ret["host_notifOpts"]) && $ret["host_notifOpts"] != NULL) $rq .= "host_notification_options = '".implode(",", array_keys($ret["host_notifOpts"]))."', "; |
| 978 | | if (isset($ret["host_notifications_enabled"]["host_notifications_enabled"])) $rq .= "host_notifications_enabled = '".$ret["host_notifications_enabled"]["host_notifications_enabled"]."', "; |
| 979 | | if (isset($ret["host_stalOpts"]) && $ret["host_stalOpts"] != NULL) $rq .= "host_stalking_options = '".implode(",", array_keys($ret["host_stalOpts"]))."', "; |
| 980 | | if (isset($ret["host_snmp_community"]) && $ret["host_snmp_community"] != NULL) $rq .= "host_snmp_community = '".htmlentities($ret["host_snmp_community"], ENT_QUOTES)."', "; |
| 981 | | if (isset($ret["host_snmp_version"]) && $ret["host_snmp_version"] != NULL) $rq .= "host_snmp_version = '".htmlentities($ret["host_snmp_version"], ENT_QUOTES)."', "; |
| 982 | | if (isset($ret["host_comment"]) && $ret["host_comment"] != NULL) $rq .= "host_comment = '".htmlentities($ret["host_comment"], ENT_QUOTES)."', "; |
| 983 | | if (isset($ret["host_register"]["host_register"]) && $ret["host_register"]["host_register"] != NULL) $rq .= "host_register = '".$ret["host_register"]["host_register"]."', "; |
| 984 | | if (isset($ret["host_activate"]["host_activate"]) && $ret["host_activate"]["host_activate"] != NULL) $rq .= "host_activate = '".$ret["host_activate"]["host_activate"]."', "; |
| | 1153 | if (isset($ret["host_template_model_htm_id"]) && $ret["host_template_model_htm_id"] != NULL) { |
| | 1154 | $rq .= "host_template_model_htm_id = '".$ret["host_template_model_htm_id"]."', "; |