Alive Check for more performance of cmd.php

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
Tobi
Posts: 1
Joined: Tue Mar 23, 2004 6:49 am

Alive Check for more performance of cmd.php

Post by Tobi »

I modified cmd.php a little bit because it took a lot of time to check
snmp for down hosts. Now Cacti is checking by a ping if the host is up
and then starts to poll by snmp.



....
include_once("include/rrd_functions.php");
include_once("include/functions.php");
include_once("include/graph_export_functions.php");

$polling_items = db_fetch_assoc("select * from data_input_data_cache");

if (sizeof($polling_items) > 0) {

#************ modified:

$ip_test = "";
$UP_test ="";

#********* finished *****
foreach ($polling_items as $item) {
switch ($item["action"]) {
case '0': /* snmp */

#********* modified :
if($ip_test != $item["management_ip"] )
{
$UP_test = system("ping -q -c 1 -w 1 $item[management_ip]") ;
$ip_test = $item["management_ip"];
}

if ($UP_test != "")
{
#********* finished *********

$output = cacti_snmp_get($item["management_ip"], $item["snmp_community"], $item["arg1"], $item["snmp_version"], $item["snmp_username"], $item["snmp_password"]);
print "snmp: " . $item["management_ip"] . ", dsname: " . $item["rrd_name"]. ", oid: " . $item["arg1"] . ", value: $output\n";

#******** modified:
}
#******** finished **********
break;
#******************************* Finished ***************
......
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests