mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
remove dead map.php code, rename some .inc to .inc.php files, general trailing space cleanup part 1, some reindent. No expected functionality change whatsoever ;)
git-svn-id: http://www.observium.org/svn/observer/trunk@1824 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
35
irc.php
35
irc.php
@@ -8,42 +8,37 @@ include("includes/discovery/functions.inc.php");
|
||||
|
||||
include_once('Net/SmartIRC.php');
|
||||
|
||||
|
||||
class observiumbot
|
||||
{
|
||||
|
||||
function device_info (&$irc, &$data)
|
||||
function device_info(&$irc, &$data)
|
||||
{
|
||||
$hostname = $data->messageex[1];
|
||||
$hostname = $data->messageex[1];
|
||||
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
|
||||
|
||||
if($device['status'] == 1) { $status = "Up " . formatUptime($device['uptime'] . " "); } else { $status = "Down "; }
|
||||
if($device['ignore']) { $status = "*Ignored*"; }
|
||||
if($device['disabled']) { $status = "*Disabled*"; }
|
||||
if($device['status'] == 1) { $status = "Up " . formatUptime($device['uptime'] . " "); } else { $status = "Down "; }
|
||||
if($device['ignore']) { $status = "*Ignored*"; }
|
||||
if($device['disabled']) { $status = "*Disabled*"; }
|
||||
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id'.$device['device_id'] . " " . $device['os'] . " " . $device['version'] . " " .
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id'.$device['device_id'] . " " . $device['os'] . " " . $device['version'] . " " .
|
||||
$device['features'] . " " . $status);
|
||||
|
||||
}
|
||||
|
||||
function port_info (&$irc, &$data)
|
||||
{
|
||||
|
||||
function port_info(&$irc, &$data)
|
||||
{
|
||||
$hostname = $data->messageex[1];
|
||||
$ifname = $data->messageex[2];
|
||||
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `hostname` = '".mres($hostname)."'"));
|
||||
$port = mysql_fetch_Array(mysql_query("SELECT * FROM `ports` WHERE `ifName` = '".$ifname."' OR `ifDescr` = '".$ifname."' AND device_id = '".$device['device_id']."'"));
|
||||
|
||||
$bps_in = formatRates($port['ifInOctets_rate']);
|
||||
$bps_out = formatRates($port['ifOutOctets_rate']);
|
||||
$pps_in = format_bi($port['ifInUcastPkts_rate']);
|
||||
$pps_out = format_bi($port['ifOutUcastPkts_rate']);
|
||||
$bps_in = formatRates($port['ifInOctets_rate']);
|
||||
$bps_out = formatRates($port['ifOutOctets_rate']);
|
||||
$pps_in = format_bi($port['ifInUcastPkts_rate']);
|
||||
$pps_out = format_bi($port['ifOutUcastPkts_rate']);
|
||||
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id' . $port['interface_id'] . " " . $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " .
|
||||
$irc->message(SMARTIRC_TYPE_CHANNEL, $data->channel, 'id' . $port['interface_id'] . " " . $port['ifAdminStatus'] . "/" . $port['ifOperStatus'] . " " .
|
||||
$bps_in. " > bps > " . $bps_out . " | " . $pps_in. "pps > PPS > " . $pps_out ."pps");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +60,4 @@ $irc->join( array( $chan ) );
|
||||
$irc->listen( );
|
||||
$irc->disconnect( );
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user