summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a56da7f)
raw | patch | inline | side by side (parent: a56da7f)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 18 Dec 2009 16:51:28 +0000 (16:51 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 18 Dec 2009 16:51:28 +0000 (16:51 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14914 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc | patch | blob | history | |
gosa-plugins/rsyslog/addons/rsyslog/rSyslog.tpl | patch | blob | history |
diff --git a/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc b/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc
index d01d9c3250bffaaca241ca6dc5554f3485e18be3..8a41d69797abc9c9a13f69dc4e390dbfb22c93db 100644 (file)
var $servers = array();
var $selected_server = "";
- var $selected_host = "%%";
+ var $selected_host = "all";
+ var $selected_priority = "all";
var $startTime = "";
var $stopTime = "";
+ var $search_for ="";
+
var $sort_value = "FromHost";
var $sort_type = "DESC";
var $limit = "0";
$s['User'] = $attrs['rSyslogUser'][0];
$s['Database'] = $attrs['rSyslogDatabase'][0];
$s['Hosts'] = array();
+ $s['Priorities'] = array();
$s['ACL'] = "";
if(isset($attrs['rSyslogPassword'])) $s['Password'] = $attrs['rSyslogPassword'][0];
$this->servers[$attrs['cn'][0]] = $s;
$this->servers[$name]['status'] = "query_failed";
$this->servers[$name]['error'] = @mysql_error();
}
+ $query = "SELECT distinct(Priority) FROM SystemEvents ORDER BY Priority;";
+ $res = @mysql_query($query, $link);
+ if($res){
+ while($attrs = @mysql_fetch_assoc($res)){
+ $this->servers[$name]['Priorities'][$attrs['Priority']] = $attrs['Priority'];
+ }
+ }else{
+ $this->servers[$name]['status'] = "query_failed";
+ $this->servers[$name]['error'] = @mysql_error();
+ }
}
}
}
$hosts = array('all' => _("All"));
$hosts = array_merge($hosts,$this->servers[$this->selected_server]['Hosts']);
}
+ if(!isset($this->servers[$this->selected_server]) || !count($this->servers[$this->selected_server]['Priorities'])){
+ $priorities = array('-' => _("-"));
+ }else{
+ $priorities = array('all' => _("All"));
+ foreach($this->servers[$this->selected_server]['Priorities'] as $id => $name){
+ $priorities[$id] = $name;
+ }
+ }
$result =$this->get_result();
$smarty->assign("servers",$this->servers);
$smarty->assign("hosts",$hosts);
+ $smarty->assign("priorities",$priorities);
$smarty->assign("selected_server",$this->selected_server);
$smarty->assign("selected_host",$this->selected_host);
+ $smarty->assign("selected_priority",$this->selected_priority);
+ $smarty->assign("search_for",$this->search_for);
$smarty->assign("startTime", $this->startTime);
$smarty->assign("stopTime", $this->stopTime);
$smarty->assign("sort_type", $this->sort_type);
$host = "%%";
if($this->selected_host != "all") $host = $this->selected_host;
+ $prio = "%%";
+ if($this->selected_priority != "all") $prio = $this->selected_priority;
$filter = "FROM SystemEvents WHERE FromHost like '{$host}' ";
+ $filter.= "AND Priority like '{$prio}' ";
$filter.= "AND DeviceReportedTime >= '".(date("Y.m.d 00:00:00", strtotime($this->startTime)))."' ";
$filter.= "AND DeviceReportedTime <= '".(date("Y.m.d 23:59:59", strtotime($this->stopTime)))."' ";
+ if(!empty($this->search_for)){
+ $filter.= "AND ( ( SysLogTag like '%".$this->search_for."%' ) OR ( Message like '%".$this->search_for."%' ) ) ";
+ }
+
// Detect amount of matching entries
$query = "SELECT count(ID) as `amount` ".$filter;
$res = @mysql_query($query, $link);
function save_object()
{
- foreach(array("selected_host","selected_server","stopTime","startTime") as $attr){
+ // Get timestamps
+ foreach(array("stopTime","startTime") as $attr){
if(isset($_POST[$attr])) $this->$attr = get_post($attr);
}
+
+ // Get server from post
+ if( isset($_POST['selected_server']) && isset($this->servers[$_POST['selected_server']])){
+ $this->selected_server = $_POST['selected_server'];
+ }
+
+ // Get Host
+ if( isset($_POST['selected_host']) &&
+ ($_POST['selected_host'] == "all" ||
+ in_array($_POST['selected_host'],$this->servers[$this->selected_server]['Hosts']))){
+ $this->selected_host = $_POST['selected_host'];
+ }
+
+ // Get priority from post
+ if( isset($_POST['selected_priority']) &&
+ ($_POST['selected_priority'] == "all" ||
+ in_array($_POST['selected_priority'],$this->servers[$this->selected_server]['Priorities']))){
+ $this->selected_priority = $_POST['selected_priority'];
+ }
+
+ // Get serach string
+ if(isset($_POST['search_for'])){
+ $this->search_for = trim(get_post('search_for'));
+ }
+ // Get page navigation attributes
if(isset($_GET['start'])) $this->page = $_GET['start'];
if(isset($_POST['limit']) && isset($this->limits[$_POST['limit']])){
$this->limit = $_POST['limit'];
}
+ // Get sorting attributes
if(isset($_GET['sort_value']) && in_array($_GET['sort_value'],
- array("DeviceReportedTime","FromHost","Facility","Priority","Message"))){
+ array("DeviceReportedTime","FromHost","Facility","Priority","Message","SysLogTag"))){
$sort_value = $_GET['sort_value'];
if($this->sort_value == $sort_value){
if($this->sort_type == "ASC"){
diff --git a/gosa-plugins/rsyslog/addons/rsyslog/rSyslog.tpl b/gosa-plugins/rsyslog/addons/rsyslog/rSyslog.tpl
index cb5ee078ffbed7c803c7c915f40632060dc9b85c..4018eca5a588711cecb9d91505d5b83f95546730 100644 (file)
{/literal}
</script>
</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{t}Priority{/t}:</td>
+ <td>
+ <select name='selected_priority' onChange='document.mainform.submit();'>
+ {html_options values=$priorities options=$priorities selected=$selected_priority}
+ </select>
+ </td>
+ <td>{t}Search{/t}:</td>
+ <td colspan="4">
+ <input type='text' name='search_for' value='{$search_for}' style='width:250px;'>
+ </td>
<td><input type='submit' name='search' value="{t}Search{/t}">
</tr>
</table>
</a>
</b>
</td>
+ <td>
+ <b>
+ <a href='?plug={$plug_id}&sort_value=SysLogTag'>{t}Log tag{/t}
+ {if $sort_value=="SysLogTag"}{if $sort_type=="DESC"}{$downimg}{else}{$upimg}{/if}{/if}
+ </a>
+ </b>
+ </td>
<td>
<b>
<a href='?plug={$plug_id}&sort_value=Facility'>{t}Facility{/t}
</b>
</td>
</tr>
- <tr><td colspan="5"><p class="separator"> </p></td></tr>
+ <tr><td colspan="6"><p class="separator"> </p></td></tr>
{foreach from=$result.entries item=item key=key}
<tr>
<td title='{$item.DeviceReportedTime}' style='width:120px'>
<td title='{$item.FromHost}'>
{$item.FromHost}
</td>
+ <td title='{$item.SysLogTag}'>
+ {$item.SysLogTag}
+ </td>
<td title='{$item.Facility}'>
{$item.Facility}
</td>
<td title='{$item.Priority}'>
{$item.Priority}
</td>
- <td title='{$item.Message}' style="width:600px">
- <div style='overflow:hidden; width:600px'><nobr>{$item.Message}</nobr></div>
+ <td title='{$item.Message}' style="width:400px">
+ <div style='overflow:hidden; width:400px'><nobr>{$item.Message}</nobr></div>
</td>
</tr>
{/foreach}