Skip to content

Commit

Permalink
Version 0.2.4
Browse files Browse the repository at this point in the history
fixed: changes for 0.8.7b
  • Loading branch information
netniV committed Dec 19, 2017
1 parent 74f6185 commit d998bfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
v0.2.4 fixed: changes for 0.8.7b

v0.2.3 fixed: typo's

v0.2.2 small fixes for 0.8.7
Expand Down
16 changes: 8 additions & 8 deletions ss_65xx_sfp.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| name : ss_65xx_sfp.php |
| version : 0.2.1 |
| date : 20070910 |
| version : 0.2.2 |
| date : 20080429 |
+-------------------------------------------------------------------------+
*/
$no_http_headers = true;
Expand Down Expand Up @@ -51,13 +51,13 @@ function ss_sfp($hostname, $snmp_community, $snmp_version, $cmd, $direction = ""
$tx_status = 0;
$int = "";
$snmp_retries = read_config_option("snmp_retries");
$var = (cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.4.1.9.9.91.1.1.1.1.1", $snmp_version, "", "", 161, 5000, $snmp_retries));
$var = (cacti_snmp_walk($hostname, $snmp_community, ".1.3.6.1.4.1.9.9.91.1.1.1.1.1", $snmp_version, "", "", 161, 5000, $snmp_retries, SNMP_POLLER));

if ($cmd == "index" || $cmd == "query") {
for ($i=0;$i<(count($var));$i++) {
if ($var[$i]["value"] == "14") { // found a dBm entry
$sensor_name = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.2.1.47.1.1.1.1.2.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries));
$sensor_status = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.5.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries));
$sensor_name = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.2.1.47.1.1.1.1.2.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries, SNMP_POLLER));
$sensor_status = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.5.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries, SNMP_POLLER));
preg_match("/[^\ ]+/", $sensor_name, $oid_name); // don't care about the rest of the string
if ($cmd == "index") {
print $oid_name[0]."\n";
Expand Down Expand Up @@ -101,16 +101,16 @@ function ss_sfp($hostname, $snmp_community, $snmp_version, $cmd, $direction = ""
} elseif ($cmd == "get") {
for ($i=0;$i<(count($var));$i++) {
if ($var[$i]["value"] == "14") { // found a dBm entry
$sensor_name = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.2.1.47.1.1.1.1.2.\\1', $var[$i]["oid"]), $snmp_version, "", "", "", 5000, $snmp_retries));
$sensor_name = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.2.1.47.1.1.1.1.2.\\1', $var[$i]["oid"]), $snmp_version, "", "", "", 5000, $snmp_retries, SNMP_POLLER));
if ($direction == "tx") {
$int=$interface." Transmit Power Sensor";
} elseif ($direction == "rx") {
$int=$interface." Receive Power Sensor";
}
preg_match("/[^\ ]+/", $sensor_name, $oid_name);
if (strstr($int, $sensor_name)) {
if (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.5.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries) == "1") {
$result = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.4.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries))/10;
if (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.5.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries, SNMP_POLLER) == "1") {
$result = (cacti_snmp_get($hostname, $snmp_community, ereg_replace('.*\.[0-9]+\.[0-9]+\.([0-9]+)$', '.1.3.6.1.4.1.9.9.91.1.1.1.1.4.\\1', $var[$i]["oid"]), $snmp_version, "", "", 161, 5000, $snmp_retries, SNMP_POLLER))/10;
}
else { $result = "-40"; // lights are off
}
Expand Down

0 comments on commit d998bfd

Please sign in to comment.