if($REQUEST_METHOD == "POST"){
// Replace this path with the path to the config.inc.php file
include ("e:\\mrtg\\conf\\config.inc.php");
// Build Cfgmaker options from the html form
$cfgmaker_option = " ".$nodown." ".$noreverse;
// Build Cfgmaker options from the html form
$cfgmaker_global_option = $growright.",".$bits;
$cfgmaker_param = "--global \"WorkDir: ".$mrtg_html_dir.$switch_ip."\""." --global \"Icondir: ".$mrtg_icon_dir."\""
." --global \"Options[_]: ".$cfgmaker_global_option."\""
." --ifdesc=".$interface_desc." --community "
.$snmp_community
.$cfgmaker_option." --output=".$mrtg_config_dir
.$switch_ip.".cfg";
$indexmaker_option = " --output=".$mrtg_html_dir.$switch_ip.".html"." --prefix=./".$switch_ip."/"." ".$mrtg_config_dir.$switch_ip.".cfg";;
// Test if the host answer telnet ('cause UDP querie is always successfull :-()
$fp = fsockopen ($switch_ip, 23, $errno, $errstr, 1);
if (!$fp) {
echo "The host:".$switch_ip." did not respond...";
echo "Back to index";
exit();
}
// Creating dir for Switch config files and stats files
if (!file_exists($switch_ip) && $switch_ip <> "") {
mkdir ($switch_ip,700);
}
// Run Cfg maker and mrtg script with argument from the form
if ($switch_ip <> "") {
if ($run_cfgmaker == "ON") {
//echo $mrtg_html_dir." ";
//echo $perl_exe." ".$cfgmaker_exe." ".$cfgmaker_param." ".$switch_ip;
system($perl_exe." ".$cfgmaker_exe." ".$cfgmaker_param." ".$switch_ip);
echo "Mrtg config for ".$switch_ip." created... ";
}
if ($run_mrtg == "ON") {
//echo $perl_exe." ".$mrtg_exe." ".$mrtg_config_dir.$switch_ip.".cfg"." ";
system ($perl_exe." ".$mrtg_exe." ".$mrtg_config_dir.$switch_ip.".cfg");
echo "1st run Mrtg stats generated... ";
}
if ($run_indexmaker == "ON") {
system ($perl_exe." ".$indexmaker_exe." ".$indexmaker_option);
echo "Mrtg html index generated... ";
}
}
}
echo " Back to index";
?>