Example #1
0
			break;
		default:
			echo "ERROR: Invalid Argument: ($arg)\n\n";
			display_help();
			exit(1);
		}
	}

	if ($displayCommunities) {
		displayCommunities($quietMode);
		exit(0);
	}

	if ($displayHostTemplates) {
		displayHostTemplates(getHostTemplates(), $quietMode);
		exit(0);
	}

	/* process the various lists into validation arrays */
	$host_templates = getHostTemplates();
	$hosts          = getHostsByDescription();
	$addresses      = getAddresses();

	/* process templates */
	if (!isset($host_templates[$template_id])) {
		echo "ERROR: Unknown template id ($template_id)\n";
		exit(1);
	}

	/* process host description */
Example #2
0
$debug    = FALSE;
$template = "";
$hostid   = "";

foreach($parms as $parameter) {
	@list($arg, $value) = @explode("=", $parameter);

	switch ($arg) {
	case "--host-template":
		$template = $value;
		break;
	case "--host-id":
		$host_id = $value;
		break;
	case "--list-host-templates":
		displayHostTemplates(getHostTemplates());
		exit(0);
	case "-d":
		$debug = TRUE;
		break;
	case "-h":
		display_help();
		exit;
	case "-v":
		display_help();
		exit;
	case "--version":
		display_help();
		exit;
	case "--help":
		display_help();
Example #3
0
			exit(0);
		case "--quiet":
			$quietMode = TRUE;

			break;
		default:
			echo __("ERROR: Invalid Argument: (") . $arg .")\n\n";
			display_help($me);
			exit(1);
		}
	}

	/*
	 * handle display options
	 */
	displayHostTemplates(getHostTemplates(), $quietMode);
	exit(0);

}else{
	displayHostTemplates(getHostTemplates(), false);
	exit(0);
}

function display_help($me) {
	echo "List Device Template Script 1.0" . ", " . __("Copyright 2004-2010 - The Cacti Group") . "\n";
	echo __("A simple command line utility to list device templates in Cacti") . "\n\n";
	echo __("usage: ") . $me . " php -q device_template_list.php\n";
	echo __("Optional:") . "\n";
	echo "   --quiet  " . __("batch mode value return") . "\n\n";
}