exit(0); /* case "get-device": echo host_id($ip); exit(0); */ /* case "get-device": echo host_id($ip); exit(0); */ case "get-graph-templates": if (!$host_template) { die("No host template specified"); } $graphs = getGraphTemplatesByHostTemplate($host_template); if (sizeof($graphs)) { foreach (array_keys($graphs) as $gtid) { echo $gtid . "\n"; } exit(0); } die("No graph templates associated with this host template"); default: die("Specified action not found, contact a developer"); } function default_die() { return "Cacti interface for freeside. Do not use for anything else."; } function host_id($ip_address, $nodie = 0)
case "--version": case "-V": case "-H": case "--help": display_help(); exit(0); default: echo "ERROR: Invalid Argument: ({$arg})\n\n"; display_help(); exit(1); } } if ($listGraphTemplates) { /* is a Host Template Id is given, print the related Graph Templates */ if ($hostTemplateId > 0) { $graphTemplates = getGraphTemplatesByHostTemplate($hostTemplateId); if (!sizeof($graphTemplates)) { echo "ERROR: You must supply a valid --host-template-id before you can list its graph templates\n"; echo "Try --list-graph-template-id --host-template-id=[ID]\n"; exit(1); } } displayGraphTemplates($graphTemplates, $quietMode); exit(0); } if ($listInputFields) { if ($templateId > 0) { $input_fields = getInputFields($templateId, $quietMode); displayInputFields($input_fields, $quietMode); } else { echo "ERROR: You must supply an graph-template-id before you can list its input fields\n";
case "-H": case "--help": case "--version": display_help($me); exit(0); case "--quiet": $quietMode = TRUE; break; default: echo __("ERROR: Invalid Argument: (%s)", $arg) . "\n\n"; display_help($me); exit(1); } } if ($listGraphTemplates) { # list graph templates $graph_templates = array(); if (isset($device["device_template_id"]) && !($device["device_template_id"] === 0)) { if (db_fetch_cell("SELECT id FROM device_template WHERE id=" . $device["device_template_id"])) { /* 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);