diff -ruBbd cacti-0.8.6f/cmd.php cacti-0.8.6f-patched/cmd.php --- cacti-0.8.6f/cmd.php 2005-06-30 23:45:49.000000000 -0400 +++ cacti-0.8.6f-patched/cmd.php 2005-07-15 20:16:30.000000000 -0400 @@ -209,15 +209,15 @@ /* assert the result with the expected value in the db; recache if the assert fails */ if (($index_item["op"] == "=") && ($index_item["assert_value"] != trim($output))) { - cacti_log("ASSERT: '" . $index_item["assert_value"] . "=" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"] . ".\n", $print_data_to_stdout); + cacti_log("ASSERT: '" . $index_item["assert_value"] . "=" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"], $print_data_to_stdout); db_execute("insert into poller_command (poller_id,time,action,command) values (0,NOW()," . POLLER_COMMAND_REINDEX . ",'" . $item["host_id"] . ":" . $index_item["data_query_id"] . "')"); $assert_fail = true; }else if (($index_item["op"] == ">") && ($index_item["assert_value"] <= trim($output))) { - cacti_log("ASSERT: '" . $index_item["assert_value"] . ">" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"] . ".\n", $print_data_to_stdout); + cacti_log("ASSERT: '" . $index_item["assert_value"] . ">" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"], $print_data_to_stdout); db_execute("insert into poller_command (poller_id,time,action,command) values (0,NOW()," . POLLER_COMMAND_REINDEX . ",'" . $item["host_id"] . ":" . $index_item["data_query_id"] . "')"); $assert_fail = true; }else if (($index_item["op"] == "<") && ($index_item["assert_value"] >= trim($output))) { - cacti_log("ASSERT: '" . $index_item["assert_value"] . "<" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"] . ".\n", $print_data_to_stdout); + cacti_log("ASSERT: '" . $index_item["assert_value"] . "<" . trim($output) . "' failed. Recaching host '" . $item["hostname"] . "', data query #" . $index_item["data_query_id"], $print_data_to_stdout); db_execute("insert into poller_command (poller_id,time,action,command) values (0,NOW()," . POLLER_COMMAND_REINDEX . ",'" . $item["host_id"] . ":" . $index_item["data_query_id"] . "')"); $assert_fail = true; } @@ -252,6 +252,10 @@ if (!$host_down) { switch ($item["action"]) { case POLLER_ACTION_SNMP: /* snmp */ + if (($item["snmp_version"] == 0) || (($item["snmp_community"] == "") && ($item["snmp_version"] != 3))) { + cacti_log("Host[$host_id] DS[$data_source] ERROR: Invalid SNMP Data Source. Please either delete it from the database, or correct it.", $print_data_to_stdout); + $output = "U"; + }else { $output = cacti_snmp_get($item["hostname"], $item["snmp_community"], $item["arg1"], $item["snmp_version"], $item["snmp_username"], $item["snmp_password"], $item["snmp_port"], $item["snmp_timeout"], SNMP_CMDPHP); /* remove any quotes from string */ @@ -267,6 +271,7 @@ cacti_log("Host[$host_id] DS[$data_source] WARNING: Result from SNMP not valid. Partial Result: " . substr($output, 0, $strout), $print_data_to_stdout); $output = "U"; } + } if (read_config_option("log_verbosity") >= POLLER_VERBOSITY_MEDIUM) { cacti_log("Host[$host_id] DS[$data_source] SNMP: v" . $item["snmp_version"] . ": " . $item["hostname"] . ", dsname: " . $item["rrd_name"] . ", oid: " . $item["arg1"] . ", output: $output",$print_data_to_stdout); diff -ruBbd cacti-0.8.6f/lib/api_poller.php cacti-0.8.6f-patched/lib/api_poller.php --- cacti-0.8.6f/lib/api_poller.php 2005-06-30 23:45:49.000000000 -0400 +++ cacti-0.8.6f-patched/lib/api_poller.php 2005-07-15 20:16:11.000000000 -0400 @@ -49,6 +49,10 @@ return true; } } else { + if ($poller_action_id == 0) { + return true; + } + $host["id"] = 0; $host["snmp_community"] = ""; $host["snmp_timeout"] = ""; @@ -59,6 +63,13 @@ $host["hostname"] = "None"; } + if ($poller_action_id == 0) { + if (($host["snmp_version"] < 1) || ($host["snmp_version"] > 3) || + ($host["snmp_community"] == "" && $host["snmp_version"] != 3)) { + return true; + } + } + return db_execute("insert into poller_item (local_data_id,host_id,action,hostname, snmp_community,snmp_version,snmp_timeout,snmp_username,snmp_password,snmp_port,rrd_name,rrd_path, rrd_num,arg1,arg2,arg3) values ($local_data_id," . $host["id"] . ",$poller_action_id,'" . $host["hostname"] . "',