Пример #1
0
 $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);
     }
     if ($dsGraph["snmpQueryType"] != "") {
         if (!isset($snmp_query_types[$dsGraph["snmpQueryType"]])) {
             echo "ERROR: Unknown snmp-query-type-id (" . $dsGraph["snmpQueryType"] . ")\n";
             echo "Try --snmp-query-id=" . $dsGraph["snmpQueryId"] . " --list-query-types\n";
             exit(1);
         }
     }
     if (!($listHosts || $listSNMPFields || $listSNMPValues || $listQueryTypes || $listSNMPQueries || $listInputFields)) {
         /* if data query is not yet associated,
          * add it and run it once to get the cache filled */
         /* is this data query already associated (independent of the reindex method)? */
         $exists_already = db_fetch_cell("SELECT COUNT(host_id) FROM host_snmp_query WHERE host_id={$hostId} AND snmp_query_id=" . $dsGraph["snmpQueryId"]);
         if (isset($exists_already) && $exists_already > 0) {
Пример #2
0
 $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;
     }
     if (isset($dsGraph["snmpQueryType"])) {
         if (!isset($snmp_query_types[$dsGraph["snmpQueryType"]])) {
             echo "Unknown snmp-query-type-id (" . $dsGraph["snmpQueryType"] . ")\n";
             echo "Try --snmp-query-id " . $dsGraph["snmpQueryId"] . " --list-query-types\n";
             return 1;
         }
     }
 }
 /* Verify the host's existance */
 if (!isset($hosts[$hostId]) || $hostId == 0) {
     echo "Unknown Host ID ({$hostId})\n";
     echo "Try --list-hosts\n";
     return 1;