Ejemplo n.º 1
0
				/* if a device Template Id is given, print the related Graph Templates */
				$graph_templates = getGraphTemplatesByHostTemplate($device["device_template_id"]);
			} else {
				echo __("ERROR: Invalid device-template-id (%d) given", $device["device_template_id"]) . "\n";
				echo __("Try -php -q device_template_list.php") . "\n";
				exit(1);
			}
		} else {
			$graph_templates = getGraphTemplates();
		}
		displayGraphTemplates($graph_templates, $quietMode);


	} elseif ($listInputFields) {	# list Input Fields
		if (isset($graph_template_id) && !($graph_template_id === 0) && (db_fetch_cell("SELECT id FROM graph_templates WHERE id=$graph_template_id"))) {
			$input_fields = getInputFields($graph_template_id, $quietMode);
			displayInputFields($input_fields, $quietMode);
		} else {
			echo __("ERROR: You must supply a valid --graph-template-id before you can list its input fields") . "\n";
			echo __("Try --list-graph-templates") . "\n";
			exit(1);
		}


	} elseif ($listQueryTypes) {	# list Data Query Types
		if (isset($ds_graph["snmpQueryId"]) && !($ds_graph["snmpQueryId"] === 0) && (db_fetch_cell("SELECT id FROM snmp_query WHERE id=" . $ds_graph["snmpQueryId"]))) {
			$snmp_query_types = getSNMPQueryTypes($ds_graph["snmpQueryId"]);
			displayQueryTypes($snmp_query_types, $quietMode);
			exit(0);
		} else {
			echo __("ERROR: You must supply a valid --snmp-query-id before you can list its query types") . "\n";
Ejemplo n.º 2
0
     exit(0);
 }
 if (!isset($graphTemplates[$templateId])) {
     echo "ERROR: Unknown graph-template-id (" . $templateId . ")\n";
     echo "Try --list-graph-templates\n";
     exit(1);
 }
 if (!isset($templateId) || !isset($hostId)) {
     echo "ERROR: Must have at least a host-id and a graph-template-id\n\n";
     display_help();
     exit(1);
 }
 if (strlen($cgInputFields)) {
     $fields = explode(" ", $cgInputFields);
     if ($templateId > 0) {
         $input_fields = getInputFields($templateId, $quietMode);
     }
     if (sizeof($fields)) {
         foreach ($fields as $option) {
             $data_template_id = 0;
             $option_value = explode("=", $option);
             if (substr_count($option_value[0], ":")) {
                 $compound = explode(":", $option_value[0]);
                 $data_template_id = $compound[0];
                 $field_name = $compound[1];
             } else {
                 $field_name = $option_value[0];
             }
             /* check for the input fields existance */
             $field_found = FALSE;
             if (sizeof($input_fields)) {
Ejemplo n.º 3
0
	$graph_template = db_fetch_row("SELECT id, name FROM graph_templates WHERE id=" . $graph_template_id);
	if (!sizeof($graph_template)) {
		echo __("ERROR: This Graph template id does not exist (%s)", $value) . "\n";
		echo __("Try php -q graph_list.php --list-graph-templates") . "\n";
		exit(1);
	}


	# let's do it, now
	$returnArray = array();

	if (strtolower($graph_type) == "cg") {
		# input fields are optional
		if ($graph_template["id"] > 0) {
			$input_fields = getInputFields($graph_template["id"], $quietMode);
		}
		$values = verifyGraphInputFields($cgInputFields, $input_fields);

		/* get devices matching criteria */
		$devices = getDevices($device);
		if (!sizeof($devices)) {
			echo __("ERROR: No matching Devices found") . "\n";
			echo __("Try php -q device_list.php") . "\n";
			exit(1);
		}

		foreach ($devices as $device) {
			# now create cg type graph(s)
			createDIGraph($device, $graph_template, $values, $graphTitle, $force);
		}