' . __('Error') . '

' . __('This installation is already up-to-date. Click here to use Cacti.', '../index.php') . '

'; exit; }elseif (preg_match('/^0\.6/', $old_cacti_version)) { print '

' . __('Error') . '

' . __('You are attempting to install Cacti %s onto a 0.6.x database. To continue, you must create a new database, import "cacti.sql" into it, and update "include/config.php" to point to the new database.', $config['cacti_version']) . '

'; exit; }elseif (empty($old_cacti_version)) { print '

' . __('Error') . '

' . __("You have created a new database, but have not yet imported the 'cacti.sql' file. At the command line, execute the following to continue:

mysql -u %s -p %s < cacti.sql

This error may also be generated if the cacti database user does not have correct permissions on the Cacti database. Please ensure that the Cacti database user has the ability to SELECT, INSERT, DELETE, UPDATE, CREATE, ALTER, DROP, INDEX on the Cacti database.", $database_username, $database_default) . '

'; print '

' . __("In Cacti %s, you must also import MySQL timezone information into MySQL and grant the Cacti user SELECT access to the mysql.time_zone_name table", $config['cacti_version']) . '

'; if ($config['cacti_server_os'] == 'unix') { print '

' . __("On Linux/UNIX, do the following:") . '

' . __("mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql") . "\n";
	}else{
		print '

' . __("On Windows, you must follow the instructions here Time zone description table. Once that is complete, you can issue the following command to grant the Cacti user access to the tables:") . '

';
	}
	print __("GRANT SELECT ON mysql.time_zone_name to '%s'@'localhost' IDENTIFIED BY '%s'", $database_username, $database_password) . '

'; exit; } /* default value for this variable */ if (isset_request_var('install_type')) { $_SESSION['sess_install_type'] = get_filter_request_var('install_type'); }elseif (isset($_SESSION['sess_install_type'])) { set_request_var('install_type', $_SESSION['sess_install_type']); }else{ set_request_var('install_type', '0'); } /* defaults for the install type dropdown */ if ($old_cacti_version == 'new_install') { $default_install_type = '1'; }else{ $default_install_type = '3'; } /* pre-processing that needs to be done for each step */ if (isset_request_var('step') && get_filter_request_var('step') > 0) { $step = get_filter_request_var('step'); switch($step) { case '1': /* license&welcome - send to checkdependencies */ $previous_step = 0; $step++; break; case '2': $previous_step = 1; /* checkdependencies - send to install/upgrade */ $step++; break; case '3': $previous_step = 2; if (get_filter_request_var('install_type') == '1') { /* install - New Primary Server */ $step = 4; }elseif (get_filter_request_var('install_type') == '2') { /* install - New Remote Poller */ $step = 4; }elseif (get_filter_request_var('install_type') == '3') { /* install/upgrade - if user chooses "Upgrade" send to upgrade */ $step = 8; } break; case '4': $previous_step = 3; /* settingscheck - send to settings-install */ $step = 5; break; case '5': $previous_step = 4; if (get_request_var('install_type') != 2) { /* settings-install - send to template-import */ $step = 6; }else{ /* remote pollers are done, no template import */ $step = 7; } break; case '6': $previous_step = 5; /* template-import - send to installfinal */ $step = 7; break; case '7': break; case '8': $previous_step = 8; /* upgrade - if user upgrades send to settingscheck */ if ($old_version_index <= array_search('0.8.5a', $cacti_versions)) { /* upgrade - if user runs old version send to upgrade-oldversion*/ $step = 9; }else{ $step = 4; } break; case '9': $previous_step = 8; /* upgrade-oldversion - if user upgrades from old version send to settingscheck */ $step = 4; break; } } else { $previous_step = 0; $step = 1; } /* installfinal - Install templates, change cacti version and send to login page */ if ($step == '7') { include_once('../lib/data_query.php'); include_once('../lib/utility.php'); include_once('../lib/import.php'); /* look for templates that have been checked for install */ if (get_request_var('install_type') == 1) { $install = Array(); foreach ($_POST as $post => $v) { if (substr($post, 0, 4) == 'chk_' && is_numeric(substr($post, 4))) { $install[] = substr($post, 4); } } $path = $config['base_path'] . '/install/templates/'; /* install templates */ $templates = install_setup_get_templates(1); if (!empty($install)) { foreach ($install as $i) { import_package($path . $templates[$i]['filename'], 1, false); } } // Add the correct device type if ($config['cacti_server_os'] == 'win32') { $hash = '5b8300be607dce4f030b026a381b91cd'; $version = 2; $community = 'public'; $avail = 'snmp'; $ip = 'localhost'; $description = "Local Windows Machine"; }else{ $hash = '2d3e47f416738c2d22c87c40218cc55e'; $version = 0; $community = 'public'; $avail = 'none'; $ip = 'localhost'; $description = "Local Linux Machine"; } $host_template_id = db_fetch_cell_prepared('SELECT id FROM host_template WHERE hash = ?', array($hash)); cacti_log('Device Template for First Cacti Device is ' . $host_template_id); // Add the host if (!empty($host_template_id)) { $results = shell_exec(read_config_option('path_php_binary') . ' -q ' . $config['base_path'] . "/cli/add_device.php" . " --description=" . escapeshellarg($description) . " --ip=" . escapeshellarg($ip) . " --template=$host_template_id" . " --notes=" . escapeshellarg('Initial Cacti Device') . " --poller=1 --site=0 --avail=" . escapeshellarg($avail) . " --version=$version --community=" . escapeshellarg($community)); cacti_log(trim($results)); }else{ cacti_log('ERROR: Device Template for your Operating System Not Found. Please add your first device manually'); } } if (get_request_var('install_type') == 2) { global $local_db_cnn_id; $success = remote_update_config_file(); /* change cacti version */ db_execute('DELETE FROM version', true, $local_db_cnn_id); db_execute("INSERT INTO version (cacti) VALUES ('" . $config["cacti_version"] . "')", true, $local_db_cnn_id); /* make the poller and poller_output_boost InnoDB */ db_execute('ALTER TABLE poller_output ENGINE=InnoDB'); db_execute('ALTER TABLE poller_output_boost ENGINE=InnoDB'); }else{ /* pre-fill poller cache with initial data on a new install only */ if ($old_cacti_version == 'new_install') { /* just in case we have hard drive graphs to deal with */ $host_id = db_fetch_cell("SELECT id FROM host WHERE hostname='127.0.0.1'"); if (!empty($host_id)) { run_data_query($host_id, 6); } /* it's always a good idea to re-populate the poller cache to make sure everything is refreshed and up-to-date */ repopulate_poller_cache(); /* fill up the snmpcache */ snmpagent_cache_rebuilt(); /* generate RSA key pair */ rsa_check_keypair(); } /* change cacti version */ db_execute('DELETE FROM version'); db_execute("INSERT INTO version (cacti) VALUES ('" . $config['cacti_version'] . "')"); } /* clear session */ setcookie(session_name(),'',time() - 3600, $config['url_path']); kill_session_var('sess_config_array'); kill_session_var('sess_host_cache_array'); /* send to login page */ header ('Location: ../index.php'); exit; /* upgrade */ }elseif (($step == '8') && (get_filter_request_var('install_type') == '3')) { /* if the version is not found, die */ if (!is_int($old_version_index)) { print "

" . __('Error') . "

" . __('Invalid Cacti version %1$s, cannot upgrade to %2$s', $old_cacti_version, $config['cacti_version']) . "

"; exit; } /* loop from the old version to the current, performing updates for each version in between */ for ($i=($old_version_index+1); $i Cacti Server Installation/Upgrade include/themes/modern/main.css' type='text/css' rel='stylesheet'> include/themes/modern/jquery.zoom.css' type='text/css' rel='stylesheet'> include/themes/modern/jquery-ui.css' type='text/css' rel='stylesheet'> include/themes/modern/default/style.css' type='text/css' rel='stylesheet'> include/themes/modern/jquery.multiselect.css' type='text/css' rel='stylesheet'> include/themes/modern/jquery.timepicker.css' type='text/css' rel='stylesheet'> include/themes/modern/jquery.colorpicker.css' type='text/css' rel='stylesheet'> include/themes/modern/pace.css' type='text/css' rel='stylesheet'> include/fa/css/font-awesome.css' type='text/css' rel='stylesheet'> images/favicon.ico' rel='shortcut icon'> images/cacti_logo.gif' sizes='96x96'>
' . __('License Agreement') . ''; print '

' . __('Thanks for taking the time to download and install Cacti, the complete graphing solution for your network. Before you can start making cool graphs, there are a few pieces of data that Cacti needs to know.') . '

'; print '

' . __('Make sure you have read and followed the required steps needed to install Cacti before continuing. Install information can be found for Unix and Win32-based operating systems.', '../docs/html/install_unix.html', '../docs/html/install_windows.html') . '

'; print '

' . __('Also, if this is an upgrade, be sure to reading the Upgrade information file.', '../docs/html/upgrade.html') . '

'; print '

' . __('Cacti is licensed under the GNU General Public License, you must agree to its provisions before continuing:') . "

"; ?>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.



' . __('Pre-installation Checks') .''; print __('Cacti requries several PHP Modules to be installed to work properly. If any of these are not installed, you will be unable to continue the installation until corrected. In addition, for optimal system performance Cacti should be run with certain MySQL system variables set. Please follow the MySQL recommendations at your discretion. Always seek the MySQL documentation if you have any questions.') . '

'; print '
' . __('The following PHP extensions are mandatory, and MUST be installed before continuing your Cacti install.') . '

'; html_start_box(' ' . __('Required PHP Modules') . '', '30', 0, '', '', false); html_header( array( __('Name'), __('Required'), __('Installed') ) ); form_selectable_cell(__('PHP Version'), ''); form_selectable_cell('5.2.0+', ''); form_selectable_cell((version_compare(PHP_VERSION, '5.2.0', '<') ? "" . PHP_VERSION . "" : "" . PHP_VERSION . ""), ''); form_end_row(); if ($config['cacti_server_os'] == 'unix') { $extensions = array( array('name' => 'posix', 'installed' => false), array('name' => 'session', 'installed' => false), array('name' => 'sockets', 'installed' => false), array('name' => 'PDO', 'installed' => false), array('name' => 'pdo_mysql', 'installed' => false), array('name' => 'xml', 'installed' => false), array('name' => 'ldap', 'installed' => false), array('name' => 'mbstring', 'installed' => false), array('name' => 'pcre', 'installed' => false), array('name' => 'json', 'installed' => false), array('name' => 'openssl', 'installed' => false), array('name' => 'gd', 'installed' => false), array('name' => 'zlib', 'installed' => false) ); }elseif (version_compare(PHP_VERSION, '5.4.5') < 0) { $extensions = array( array('name' => 'session', 'installed' => false), array('name' => 'sockets', 'installed' => false), array('name' => 'PDO', 'installed' => false), array('name' => 'pdo_mysql', 'installed' => false), array('name' => 'xml', 'installed' => false), array('name' => 'ldap', 'installed' => false), array('name' => 'mbstring', 'installed' => false), array('name' => 'pcre', 'installed' => false), array('name' => 'json', 'installed' => false), array('name' => 'openssl', 'installed' => false), array('name' => 'gd', 'installed' => false), array('name' => 'zlib', 'installed' => false) ); }else{ $extensions = array( array('name' => 'com_dotnet','installed' => false), array('name' => 'session', 'installed' => false), array('name' => 'sockets', 'installed' => false), array('name' => 'PDO', 'installed' => false), array('name' => 'pdo_mysql', 'installed' => false), array('name' => 'xml', 'installed' => false), array('name' => 'ldap', 'installed' => false), array('name' => 'mbstring', 'installed' => false), array('name' => 'pcre', 'installed' => false), array('name' => 'json', 'installed' => false), array('name' => 'openssl', 'installed' => false), array('name' => 'gd', 'installed' => false), array('name' => 'zlib', 'installed' => false) ); } $ext = verify_php_extensions($extensions); $enabled = '1'; foreach ($ext as $id =>$e) { form_alternate_row('line' . $id); form_selectable_cell($e['name'], ''); form_selectable_cell('' . __('Yes') . '', ''); form_selectable_cell(($e['installed'] ? '' . __('Yes') . '' : '' . __('No') . ''), ''); form_end_row(); if (!$e['installed']) $enabled = '0'; } html_end_box(false); print '
' . __('The following PHP extensions are recommended, and should be installed before continuing your Cacti install.') . '

'; $extensions = array( array('name' => 'snmp', 'installed' => false), array('name' => 'gmp', 'installed' => false) ); $ext = verify_php_extensions($extensions); html_start_box(' ' . __('Optional Modules') . '', '30', 0, '', '', false); html_header( array( __('Name'), __('Required'), __('Installed') ) ); foreach ($ext as $id => $e) { form_alternate_row('line' . $id, true); form_selectable_cell($e['name'], ''); form_selectable_cell('' . __('Yes') . '', ''); form_selectable_cell(($e['installed'] ? '' . __('Yes') . '' : '' . __('No') . ''), ''); form_end_row(); } html_end_box(); print '
' . __('These MySQL performance tuning settings will help your Cacti system perform better without issues for a longer time.') . '

'; html_start_box(' ' . __('Recommended MySQL System Variable Settings') . '', '30', 0, '', '', false); utilities_get_mysql_recommendations(); html_end_box(false); /* install/upgrade */ }elseif ($step == '3') { print '

' . __('Installation Type') . '

'; print '

' . __('Please select the type of installation') . '

'; print '

' . __('You have three Cacti installation options to choose from:') . '

'; print '

    '; print '
  • ' . __('New Primary Server') . ' - ' . __('Choose this for the Primary Cacti Web Site.') . '
  • '; print '
  • ' . __('New Remote Poller') . ' - ' . __('Remote Pollers are used to access networks that are not readily accessible to the Primary Cacti Web Site.') . '
  • '; print '
  • ' . __('Upgrade Previous Cacti') . ' - ' . __('Use this option to upgrade a previous release of Cacti') . '
  • '; print '

'; print '

'; if ($default_install_type == '3') { print '

' . __('WARNING - If you are upgrading from a previous version please close all Cacti browser sessions and clear cache before continuing') . '

'; } print '

' . __('The following information has been determined from Cacti\'s configuration file. If it is not correct, please edit "include/config.php" before continuing.') . '

'; print ''; print ''; print ''; ?> ' . __('Critical Binary Locations and Versions') . ''; print '

' . __('Make sure all of these values are correct before continuing.') . '

'; $i = 0; $input = install_file_paths(); /* find the appropriate value for each 'config name' above by config.php, database, * or a default for fall back */ while (list($name, $array) = each($input)) { if (isset($input[$name])) { $current_value = $array['default']; /* run a check on the path specified only if specified above, then fill a string with the results ('FOUND' or 'NOT FOUND') so they can be displayed on the form */ $form_check_string = ''; /* draw the acual header and textbox on the form */ print '

' . $array['friendly_name'] . ''; if (!empty($array['friendly_name'])) { print ': ' . $array['description']; }else{ print '' . $array['description'] . ''; } print '
'; switch ($array['method']) { case 'textbox': form_text_box($name, $current_value, '', '', '40', 'text'); break; case 'filepath': form_filepath_box($name, $current_value, '', '', '40', 'text'); break; case 'drop_array': form_dropdown($name, $array['array'], '', '', $current_value, '', ''); break; } print '

'; } $i++; } if (get_request_var('install_type') != 2) { print '

'; print __('NOTE:') . ' ' . __('Once you click "Finish", all of your settings will be saved and your database will be upgraded if this is an upgrade.'); print __('You can change any of the settings on this screen at a later time by going to "Cacti Settings" from within Cacti.'); print '

'; } /* settings-install */ }elseif ($step == '5') { include_once('../lib/data_query.php'); include_once('../lib/utility.php'); $i = 0; $input = install_file_paths(); /* get all items on the form and write values for them */ while (list($name, $array) = each($input)) { if (isset_request_var($name)) { db_execute_prepared("REPLACE INTO settings (name,value) VALUES (?, ?)", array($name, get_nfilter_request_var($name))); } } /* Print message and error logs */ print '

' . __('Directory Permission Checks') . '

'; print '

' . __('Please insure the directory permissions below are correct before proceeding. During the install, these directories need to be owned by the Apache user, either apache or wwwrun depending on your Operating System.') . '

'; if (get_request_var('install_type') == 1) { print '

' . __('After the install is complete, you can make some of these directories read only to increase security.') . '

'; }else{ print '

' . __('These directories will be required to stay read writable after the instal so that the Cacti remote synchonization process can update them as the Main Cacti Web Site changes') . '

'; } $remote_poller = array( $config['base_path'] . '/resource/snmp_queries', $config['base_path'] . '/resource/script_server', $config['base_path'] . '/resource/script_queries', $config['base_path'] . '/scripts', $config['base_path'] . '/log', $config['base_path'] . '/cache/boost', $config['base_path'] . '/cache/mibcache', $config['base_path'] . '/cache/realtime', $config['base_path'] . '/cache/spikekill' ); $always_paths = array( $config['base_path'] . '/log', $config['base_path'] . '/cache/boost', $config['base_path'] . '/cache/mibcache', $config['base_path'] . '/cache/realtime', $config['base_path'] . '/cache/spikekill' ); $install_paths = array( $config['base_path'] . '/resource/snmp_queries', $config['base_path'] . '/resource/script_server', $config['base_path'] . '/resource/script_queries', $config['base_path'] . '/scripts', ); if (get_request_var('install_type') != 2) { print '

' . __('Required Writable at Install Time Only') . '

'; foreach($install_paths as $path) { if (is_writable($path)) { print '

'. $path . ' is ' . __('Writable') . '

'; } else { print '

'. $path . ' is ' . __('Not Writable') . '

'; $writable = false; } } print '

' . __('Required Writable after Install Complete') . '

'; foreach($always_paths as $path) { if (is_writable($path)) { print '

'. $path . ' is ' . __('Writable') . '

'; } else { print '

'. $path . ' is ' . __('Not Writable') . '

'; $writable = false; } } }else{ print '

' . __('Required Writable after Install Complete') . '

'; foreach($remote_paths as $path) { if (is_writable($path)) { print '

'. $path . ' is ' . __('Writable') . '

'; } else { print '

'. $path . ' is ' . __('Not Writable') . '

'; $writable = false; } } } /* Print help message for unix and windows if directory is not writable */ if (($config['cacti_server_os'] == 'unix') && isset($writable)) { print '

' . __('Make sure your webserver has read and write access to the entire folder structure.
Example: chown -R apache.apache %s/resource/', $config['base_path']) . '

'; print '

' . __('For SELINUX-users make sure that you have the correct permissions or set \'setenforce 0\' temporarily.') . '


'; }elseif (($config['cacti_server_os'] == 'win32') && isset($writable)){ print __('Check Permissions'); }else { print '' . __('All folders are writable') . '

'; } if (get_request_var('install_type') != 2) { print '

'; print __('NOTE:') . ' ' . __('If you are installing packages, once the packages are installed, you should change the scripts directory back to read only as this presents some exposure to the web site.'); print '

'; }else{ print '

'; print __('NOTE:') . ' ' . __('For remote pollers, it is critical that the paths that you will be updating frequently, including the plugins, scripts, and resources paths have read/write access as the data collector will have to update these paths from the main web server content.'); print '

'; } /* template-import */ }elseif ($step == '6') { print '

' . __('Template Setup') . '

'; print '

' . __('Please select the Device Templates that you wish to use after the Install. If you Operating System is Windows, you need to insure that you select the \'Windows Device\' Template. If your Operating System is Linux/UNIX, make sure you select the \'Local Linux Machine\' Device Template.') . '

'; print __('Device Templates allow you to monitor and graph a vast assortment of data within Cacti. After you select the desired Device Templates, press \'Finish\' and the installation will complete. Please be patient on this step, as the importation of the Device Templates can take a few minutes.') . '

'; print ''; $templates = plugin_setup_get_templates(); html_start_box('' . __('Templates') . '', '100%', '3', 'center', '', ''); html_header_checkbox( array( __('Name'), __('Description'), __('Author'), __('Homepage') ) ); foreach ($templates as $id => $p) { form_alternate_row('line' . $id, true); form_selectable_cell($p['name'], $id); form_selectable_cell($p['description'], $id); form_selectable_cell($p['author'], $id); if ($p['homepage'] != '') { form_selectable_cell('' . $p['homepage'] . '', $id); } else { form_selectable_cell('', $id); } form_checkbox_cell($p['name'], $id); form_end_row(); } html_end_box(false); print '

' . __('NOTE:') . ' '; print __('Press \'Finish\' to complete the installation process after selecting your Device Templates.') . '

'; /* upgrade */ }elseif ($step == '8') { print '

' . __('Upgrade results:') . '

'; $current_version = ''; $upgrade_results = ''; $failed_sql_query = false; $sqltext = array(); $sqltext[0] = '' . __('[Fail]') . ' '; $sqltext[1] = '' . __('[Success]') . ' '; $sqltext[2] = '' . __('[Not Ran]') . ' '; if (isset($_SESSION['sess_sql_install_cache'])) { while (list($index, $arr1) = each($_SESSION['sess_sql_install_cache'])) { while (list($version, $arr2) = each($arr1)) { while (list($status, $sql) = each($arr2)) { if ($current_version != $version) { $version_index = array_search($version, $cacti_versions); $upgrade_results .= '

' . (isset($cacti_versions{$version_index-1}) ? $cacti_versions{$version_index-1}:'') . ' -> ' . $cacti_versions{$version_index} . "

\n"; } $upgrade_results .= "

" . $sqltext[$status] . nl2br($sql) . "

\n"; /* if there are one or more failures, make a note because we are going to print out a warning to the user later on */ if ($status == 0) { $failed_sql_query = true; } $current_version = $version; } } } kill_session_var('sess_sql_install_cache'); }else{ print '' . __('No SQL queries have been executed.') . ''; } if ($failed_sql_query == true) { print '

' . __('WARNING:') . ' ' . __('One or more of the SQL queries needed to upgraded your Cacti installation has failed. Please see below for more details. Your Cacti MySQL user must have SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, and DROP permissions. You should try executing the failed queries as "root" to ensure that you do not have a permissions problem.') . "

\n"; } print $upgrade_results; /* upgrade-oldversion */ }elseif ($step == '9') { print '

' . __('Important Upgrade Notice') . '

'; print '

' . __('Before you continue with the installation, you must update your /etc/crontab file to point to poller.php instead of cmd.php.') . '

'; print '

' . __('See the sample crontab entry below with the change made in red. Your crontab line will look slightly different based upon your setup.') . '

'; print '

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1

'; print '

' . __('Once you have made this change, please click Finish to continue.') . '

'; }?>
1) {?>'> '> ' value=''>