mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
make sensor_type larger, merge both logs into one tab (ran out of space!)
git-svn-id: http://www.observium.org/svn/observer/trunk@2719 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@ -928,7 +928,7 @@ CREATE TABLE IF NOT EXISTS `sensors` (
|
|||||||
`poller_type` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'snmp',
|
`poller_type` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'snmp',
|
||||||
`sensor_oid` varchar(64) CHARACTER SET latin1 NOT NULL,
|
`sensor_oid` varchar(64) CHARACTER SET latin1 NOT NULL,
|
||||||
`sensor_index` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
|
`sensor_index` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
|
||||||
`sensor_type` varchar(32) CHARACTER SET latin1 NOT NULL,
|
`sensor_type` varchar(255) CHARACTER SET latin1 NOT NULL,
|
||||||
`sensor_descr` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
|
`sensor_descr` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
`sensor_divisor` int(11) NOT NULL DEFAULT '1',
|
`sensor_divisor` int(11) NOT NULL DEFAULT '1',
|
||||||
`sensor_multiplier` int(11) NOT NULL DEFAULT '1',
|
`sensor_multiplier` int(11) NOT NULL DEFAULT '1',
|
||||||
|
@ -19,6 +19,5 @@ ALTER TABLE `bills` ADD `rate_average_in` int(11) NOT NULL;
|
|||||||
ALTER TABLE `bills` ADD `rate_average_out` int(11) NOT NULL;
|
ALTER TABLE `bills` ADD `rate_average_out` int(11) NOT NULL;
|
||||||
ALTER TABLE `bills` ADD `rate_average` int(11) NOT NULL;
|
ALTER TABLE `bills` ADD `rate_average` int(11) NOT NULL;
|
||||||
ALTER TABLE `bills` ADD `bill_last_calc` datetime NOT NULL;
|
ALTER TABLE `bills` ADD `bill_last_calc` datetime NOT NULL;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `bill_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bill_id` int(11) NOT NULL, `bill_datefrom` datetime NOT NULL, `bill_dateto` datetime NOT NULL, `bill_type` text NOT NULL, `bill_allowed` int(11) NOT NULL, `bill_used` int(11) NOT NULL, `bill_overuse` int(11) NOT NULL, `bill_percent` decimal(5,2) NOT NULL, `rate_95th_in` int(11) NOT NULL, `rate_95th_out` int(11) NOT NULL, `rate_95th` int(11) NOT NULL, `dir_95th` varchar(3) NOT NULL, `rate_average` int(11) NOT NULL, `rate_average_in` int(11) NOT NULL, `rate_average_out` int(11) NOT NULL, `traf_in` int(11) NOT NULL, `traf_out` int(11) NOT NULL, `traf_total` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `bill_id` (`bill_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
CREATE TABLE IF NOT EXISTS `bill_history` ( `id` int(11) NOT NULL AUTO_INCREMENT, `bill_id` int(11) NOT NULL, `bill_datefrom` datetime NOT NULL, `bill_dateto` datetime NOT NULL, `bill_type` text NOT NULL, `bill_allowed` int(11) NOT NULL, `bill_used` int(11) NOT NULL, `bill_overuse` int(11) NOT NULL, `bill_percent` decimal(5,2) NOT NULL, `rate_95th_in` int(11) NOT NULL, `rate_95th_out` int(11) NOT NULL, `rate_95th` int(11) NOT NULL, `dir_95th` varchar(3) NOT NULL, `rate_average` int(11) NOT NULL, `rate_average_in` int(11) NOT NULL, `rate_average_out` int(11) NOT NULL, `traf_in` int(11) NOT NULL, `traf_out` int(11) NOT NULL, `traf_total` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `bill_id` (`bill_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||||
|
ALTER TABLE `sensors` CHANGE `sensor_oid` `sensor_oid` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;
|
||||||
|
@ -15,7 +15,7 @@ echo('<tr style="background-color: ' . $bg . '">
|
|||||||
' . $entry['datetime'] . '
|
' . $entry['datetime'] . '
|
||||||
</td>');
|
</td>');
|
||||||
|
|
||||||
if (!isset($_GET['id']) && (!isset($overview) || $overview == 0)) {
|
if (!isset($vars['device'])) {
|
||||||
$dev = device_by_id_cache($entry['host']);
|
$dev = device_by_id_cache($entry['host']);
|
||||||
echo("<td class=list-bold width=150>
|
echo("<td class=list-bold width=150>
|
||||||
" . generate_device_link($dev, shorthost($dev['hostname'])) . "
|
" . generate_device_link($dev, shorthost($dev['hostname'])) . "
|
||||||
@ -24,7 +24,8 @@ if (!isset($_GET['id']) && (!isset($overview) || $overview == 0)) {
|
|||||||
|
|
||||||
if ($entry['type'] == "interface")
|
if ($entry['type'] == "interface")
|
||||||
{
|
{
|
||||||
$entry['link'] = "<b>".generate_port_link(getifbyid($entry['reference']))."</b>";
|
$this_if = ifLabel(getifbyid($entry['reference']));
|
||||||
|
$entry['link'] = "<b>".generate_port_link($this_if, makeshortif(strtolower($this_if['label'])))."</b>";
|
||||||
} else {
|
} else {
|
||||||
$entry['link'] = "System";
|
$entry['link'] = "System";
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,13 @@ if (device_permitted($entry['device_id']))
|
|||||||
|
|
||||||
$entry['hostname'] = shorthost($entry['hostname'], 20);
|
$entry['hostname'] = shorthost($entry['hostname'], 20);
|
||||||
|
|
||||||
if ($_GET['page'] != "device")
|
if ($vars['page'] != "device")
|
||||||
{
|
{
|
||||||
echo("<td class=syslog width=140>" . $entry['date'] . "</td>");
|
echo("<td class=syslog width=140>" . $entry['date'] . "</td>");
|
||||||
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
||||||
echo("<td class=syslog><strong>" . $entry['program'] . " : </strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
echo("<td class=syslog><strong>" . $entry['program'] . " : </strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
||||||
} else {
|
} else {
|
||||||
echo("<td class=syslog><i>" . $entry['date'] . "</i> <strong>" . $entry['program'] . "</strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
echo("<td class=syslog><i>" . $entry['date'] . "</i> <strong>" . $entry['program'] . "</strong> " . htmlspecialchars($entry['msg']) . "</td>");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo("</tr>");
|
echo("</tr>");
|
||||||
|
@ -222,18 +222,9 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
|||||||
|
|
||||||
if (device_permitted($device['device_id']))
|
if (device_permitted($device['device_id']))
|
||||||
{
|
{
|
||||||
echo('<li class="' . $select['events'] . '">
|
echo('<li class="' . $select['logs'] . '">
|
||||||
<a href="'.generate_device_url($device, array('tab' => 'events')).'">
|
<a href="'.generate_device_url($device, array('tab' => 'logs')).'">
|
||||||
<img src="images/16/report_magnify.png" align="absmiddle" border="0" /> Events
|
<img src="images/16/report_magnify.png" align="absmiddle" border="0" /> Logs
|
||||||
</a>
|
|
||||||
</li>');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($config['enable_syslog'])
|
|
||||||
{
|
|
||||||
echo('<li class="' . $select['syslog'] . '">
|
|
||||||
<a href="'.generate_device_url($device, array('tab' => 'syslog')).'">
|
|
||||||
<img src="images/16/printer.png" align="absmiddle" border="0" /> Syslog
|
|
||||||
</a>
|
</a>
|
||||||
</li>');
|
</li>');
|
||||||
}
|
}
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
|
|
||||||
echo('<table cellspacing="0" cellpadding="2" width="100%">');
|
|
||||||
|
|
||||||
foreach ($entries as $entry)
|
|
||||||
{
|
|
||||||
include("includes/print-event.inc.php");
|
|
||||||
}
|
|
||||||
|
|
||||||
echo('</table>');
|
|
||||||
|
|
||||||
$pagetitle[] = "Events";
|
|
||||||
|
|
||||||
?>
|
|
41
html/pages/device/logs/eventlog.inc.php
Normal file
41
html/pages/device/logs/eventlog.inc.php
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<hr />
|
||||||
|
|
||||||
|
<form method="post" action="">
|
||||||
|
<label><strong>Search</strong>
|
||||||
|
<input type="text" name="string" id="string" value="<?php echo($_POST['string']); ?>" />
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<strong>Type</strong>
|
||||||
|
<select name="type" id="type">
|
||||||
|
<option value="">All Types</option>
|
||||||
|
<option value="system">System</option>
|
||||||
|
<?php
|
||||||
|
foreach (dbFetchRows("SELECT `type` FROM `eventlog` WHERE device_id = ? GROUP BY `type` ORDER BY `type`", array($device['device_id'])) as $data)
|
||||||
|
{
|
||||||
|
echo("<option value='".$data['type']."'");
|
||||||
|
if ($data['type'] == $_POST['type']) { echo("selected"); }
|
||||||
|
echo(">".$data['type']."</option>");
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<input class=submit type=submit value=Search>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
print_optionbar_end();
|
||||||
|
|
||||||
|
$entries = dbFetchRows("SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` WHERE `host` = ? ORDER BY `datetime` DESC LIMIT 0,250", array($device['device_id']));
|
||||||
|
echo('<table cellspacing="0" cellpadding="2" width="100%">');
|
||||||
|
|
||||||
|
foreach ($entries as $entry)
|
||||||
|
{
|
||||||
|
include("includes/print-event.inc.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
echo('</table>');
|
||||||
|
|
||||||
|
$pagetitle[] = "Events";
|
||||||
|
|
||||||
|
?>
|
@ -1,8 +1,5 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
print_optionbar_start('25');
|
<hr />
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<label><strong>Search</strong>
|
<label><strong>Search</strong>
|
@ -34,15 +34,17 @@ function get_cache($host, $value) {
|
|||||||
|
|
||||||
function process_syslog ($entry, $update) {
|
function process_syslog ($entry, $update) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
global $dev_cache;
|
global $dev_cache;
|
||||||
|
|
||||||
foreach ($config['syslog_filter'] as $bi)
|
foreach ($config['syslog_filter'] as $bi)
|
||||||
if (strpos($entry['msg'], $bi) !== FALSE) {
|
{
|
||||||
|
if (strpos($entry['msg'], $bi) !== FALSE)
|
||||||
|
{
|
||||||
print_r($entry);
|
print_r($entry);
|
||||||
echo('D-'.$bi);
|
echo('D-'.$bi);
|
||||||
return $entry;
|
return $entry;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$entry['device_id'] = get_cache($entry['host'], 'device_id');
|
$entry['device_id'] = get_cache($entry['host'], 'device_id');
|
||||||
if ($entry['device_id']) {
|
if ($entry['device_id']) {
|
||||||
|
Reference in New Issue
Block a user