* * * * * <user> wget -q -O - --no-check-certificate '; $message_conf_cron .= str_replace( ENTERPRISE_DIR.'/meta/', '', ui_get_full_url(false) ); $message_conf_cron .= ENTERPRISE_DIR.'/'.EXTENSIONS_DIR; $message_conf_cron .= '/cron/cron.php >>'; $message_conf_cron .= $config['homedir'].'/log/cron.log'; } if (isset($config['cron_last_run']) === true) { $message_conf_cron .= __('Last execution').': '; $message_conf_cron .= date('Y/m/d H:i:s', $config['cron_last_run']); $message_conf_cron .= __('Please, make sure process is not locked.'); } $this->notify( [ 'type' => 'NOTIF.CRON.CONFIGURED', 'title' => __('DiscoveryConsoleTasks is not configured.'), 'message' => __($message_conf_cron), 'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'), ] ); } else { $this->cleanNotifications('NOTIF.CRON.CONFIGURED'); } } /** * Search for messages. * * @return void */ public function getUMMessages() { global $config; include_once $config['homedir'].'/include/functions_update_manager.php'; if (update_manager_verify_registration() === false) { // Console not subscribed. return; } // Avoid contact for messages too much often. if (isset($config['last_um_check']) === true && time() < $config['last_um_check'] ) { return; } $messages = update_manager_get_messages(); if (is_array($messages) === true) { $source_id = get_notification_source_id( 'Official communication' ); foreach ($messages as $message) { if (isset($message['url']) === false) { $message['url'] = '#'; } $this->notify( [ 'type' => 'NOTIF.UPDATEMANAGER.MESSAGES.'.$message['id'], 'title' => $message['subject'], 'message' => base64_decode($message['message_html']), 'url' => $message['url'], ], $source_id ); } } } /** * Check if all servers and console versions are the same * * @return void */ public function checkConsoleServerVersions() { global $config; // List all servers except satellite server. $server_version_list = db_get_all_rows_sql( sprintf( 'SELECT `name`, `version` FROM tserver WHERE server_type != %d GROUP BY `version`', SERVER_TYPE_ENTERPRISE_SATELLITE ) ); $missed = 0; if (is_array($server_version_list) === true) { foreach ($server_version_list as $server) { if (strpos( $server['version'], $config['current_package'] ) === false ) { $missed++; $title_ver_misaligned = __( '%s version misaligned with Console', $server['name'] ); $message_ver_misaligned = __( 'Server %s and this console have different versions. This might cause several malfunctions. Please, update this server.', $server['name'] ); $this->notify( [ 'type' => 'NOTIF.SERVER.MISALIGNED', 'title' => __($title_ver_misaligned), 'message' => __($message_ver_misaligned), 'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'), ] ); } } } // Cleanup notifications if exception is recovered. if ($missed == 0) { $this->cleanNotifications('NOTIF.SERVER.MISALIGNED'); } } /** * Check if AllowOveride is None or All. * * @return void */ public function checkAllowOverrideEnabled() { global $config; $message = 'If AllowOverride is disabled, .htaccess will not works.'; $message .= '
Please check /etc/httpd/conf/httpd.conf to resolve this problem.'; // Get content file. $file = file_get_contents('/etc/httpd/conf/httpd.conf'); $file_lines = preg_split("#\r?\n#", $file, -1, PREG_SPLIT_NO_EMPTY); $is_none = false; $i = 0; foreach ($file_lines as $line) { $i++; // Check Line and content. if (preg_match('/ AllowOverride/', $line) && $i === 311) { $result = explode(' ', $line); if ($result[5] == 'None') { $is_none = true; $this->notify( [ 'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE', 'title' => __('AllowOverride is disabled'), 'message' => __($message), 'url' => ui_get_full_url('index.php'), ] ); } } } // Cleanup notifications if AllowOverride is All. if (!$is_none) { $this->cleanNotifications('NOTIF.ALLOWOVERRIDE.MESSAGE'); } } /** * Check if AllowOveride is None or All. * * @return void */ public function checkHaStatus() { global $config; enterprise_include_once('include/class/DatabaseHA.class.php'); $cluster = new DatabaseHA(); $nodes = $cluster->getNodes(); foreach ($nodes as $node) { if ($node['status'] == HA_DISABLED) { continue; } $cluster_master = $cluster->isClusterMaster($node); $db_master = $cluster->isDBMaster($node); $message = 'The roles played by node '.$node['host'].' are out of sync: Role in the cluster: Master Role in the database: Slave Desynchronized operation in the node'; if ((int) $db_master !== (int) $cluster_master) { $this->notify( [ 'type' => 'NOTIF.HAMASTER.MESSAGE', 'title' => __('Desynchronized operation on the node '.$node['host']), 'message' => __($message), 'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'), ] ); } else { $this->cleanNotifications('NOTIF.HAMASTER.MESSAGE'); } } } /** * Check if Pandora console log file remains in old location. * * @return void */ public function checkPandoraConsoleLogOldLocation() { global $config; if (file_exists($config['homedir'].'/pandora_console.log')) { $title_pandoraconsole_old_log = __( 'Pandora FMS console log file changed location', $config['homedir'] ); $message_pandoraconsole_old_log = __( 'Pandora FMS console log file has been moved to new location %s/log. Currently you have an outdated and inoperative version of this file at %s. Please, consider deleting it.', $config['homedir'], $config['homedir'] ); $url = 'https://pandorafms.com/manual/en/quickguides/general_quick_guide#solving_problems_where_to_look_and_who_to_ask'; if ($config['language'] == 'es') { $url = 'https://pandorafms.com//manual/es/quickguides/general_quick_guide#solucion_de_problemas_donde_mirar_a_quien_preguntar'; } $this->notify( [ 'type' => 'NOTIF.PANDORACONSOLE.LOG.OLD', 'title' => __($title_pandoraconsole_old_log), 'message' => __($message_pandoraconsole_old_log), 'url' => $url, ] ); } else { $this->cleanNotifications('NOTIF.PANDORACONSOLE.LOG.OLD'); } } /** * Check if audit log file remains in old location. * * @return void */ public function checkAuditLogOldLocation() { global $config; if (file_exists($config['homedir'].'/audit.log')) { $title_audit_old_log = __( 'Pandora FMS audit log file changed location', $config['homedir'] ); $message_audit_old_log = __( 'Pandora FMS audit log file has been moved to new location %s/log. Currently you have an outdated and inoperative version of this file at %s. Please, consider deleting it.', $config['homedir'], $config['homedir'] ); $this->notify( [ 'type' => 'NOTIF.AUDIT.LOG.OLD', 'title' => __($title_audit_old_log), 'message' => __($message_audit_old_log), 'url' => '#', ] ); } else { $this->cleanNotifications('NOTIF.AUDIT.LOG.OLD'); } } /** * Clean Phantom cache if needed. * * @return void */ public function checkCleanPhantomCache() { global $config; if ((int) $config['clean_phantomjs_cache'] !== 1) { return; } $cache_dir = $config['homedir'].'/attachment/cache'; if (is_dir($cache_dir) === true) { rrmdir($cache_dir); } // Clean process has ended. config_update_value( 'clean_phantomjs_cache', 0 ); } }