default: echo "ERROR: Invalid Argument: ($arg)\n\n"; display_help(); exit(1); } } /* list options, recognizing $quietMode */ if ($displayHosts) { $hosts = getHosts(); displayHosts($hosts, $quietMode); exit(0); } if ($displayDataQueries) { $data_queries = getSNMPQueries(); displaySNMPQueries($data_queries, $quietMode); exit(0); } /* * verify required parameters * for update / insert options */ if (!isset($host_id)) { echo "ERROR: You must supply a valid host-id for all hosts!\n"; exit(1); } if (!isset($data_query_id)) { echo "ERROR: You must supply a valid data-query-id for all hosts!\n"; exit(1);
displayInputFields($input_fields, $quietMode); } else { echo "ERROR: You must supply an graph-template-id before you can list its input fields\n"; echo "Try --graph-template-id=[ID] --list-input-fields\n"; exit(1); } exit(0); } if ($listHosts) { displayHosts($hosts, $quietMode); exit(0); } /* get the existing snmp queries */ $snmpQueries = getSNMPQueries(); if ($listSNMPQueries) { displaySNMPQueries($snmpQueries, $quietMode); exit(0); } /* Some sanity checking... */ if ($dsGraph["snmpQueryId"] != "") { if (!isset($snmpQueries[$dsGraph["snmpQueryId"]])) { echo "ERROR: Unknown snmp-query-id (" . $dsGraph["snmpQueryId"] . ")\n"; echo "Try --list-snmp-queries\n"; exit(1); } /* get the snmp query types for comparison */ $snmp_query_types = getSNMPQueryTypes($dsGraph["snmpQueryId"]); if ($listQueryTypes) { displayQueryTypes($snmp_query_types, $quietMode); exit(0); }
case "--list-graph-templates": displayGraphTemplates($graphTemplates); return 0; default: display_help(); return 0; } } if ($listHosts) { displayHosts($hosts); return 0; } /* get the existing snmp queries */ $snmpQueries = getSNMPQueries(); if ($listSNMPQueries == 1) { displaySNMPQueries($snmpQueries); return 0; } /* Some sanity checking... */ if (isset($dsGraph["snmpQueryId"])) { if (!isset($snmpQueries[$dsGraph["snmpQueryId"]])) { echo "Unknown snmp-query-id (" . $dsGraph["snmpQueryId"] . ")\n"; echo "Try --list-snmp-queries\n"; return 1; } /* get the snmp query types for comparison */ $snmp_query_types = getSNMPQueryTypes($dsGraph["snmpQueryId"]); if ($listQueryTypes == 1) { displayQueryTypes($snmp_query_types); return 0; }