25
25
$page["title"] = "S_QUEUE_BIG";
26
26
$page["file"] = "queue.php";
27
$page['hist_arg'] = array('show');
27
$page['hist_arg'] = array('config');
29
29
define('ZBX_PAGE_DO_REFRESH', 1);
35
35
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
37
"show"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1,2"), NULL)
37
"config"=> array(T_ZBX_INT, O_OPT, P_SYS, IN("0,1,2"), NULL)
40
40
check_fields($fields);
46
$_REQUEST["show"] = get_request("show", 0);
46
$_REQUEST['config'] = get_request('config', get_profile('web.queue.config', 0));
47
update_profile('web.queue.config',$_REQUEST['config'], PROFILE_TYPE_INT);
48
49
$form = new CForm();
49
50
$form->SetMethod('get');
51
$cmbMode = new CComboBox("show", $_REQUEST["show"], "submit();");
52
$cmbMode = new CComboBox("config", $_REQUEST["config"], "submit();");
52
53
$cmbMode->AddItem(0, S_OVERVIEW);
53
54
$cmbMode->AddItem(1, S_OVERVIEW_BY_PROXY);
54
55
$cmbMode->AddItem(2, S_DETAILS);
73
74
//ITEM_TYPE_HTTPTEST,
74
75
ITEM_TYPE_EXTERNAL);
76
$result = DBselect('SELECT i.itemid,i.nextcheck,i.description,i.key_,i.type,h.host,h.hostid,h.proxy_hostid '.
77
$result = DBselect('SELECT i.itemid,i.lastclock,i.description,i.key_,i.type,h.host,h.hostid,h.proxy_hostid,i.delay,i.delay_flex '.
77
78
' FROM items i,hosts h '.
78
79
' WHERE i.status='.ITEM_STATUS_ACTIVE.
79
80
' AND i.type in ('.implode(',',$item_types).') '.
80
81
' AND ((h.status='.HOST_STATUS_MONITORED.' AND h.available != '.HOST_AVAILABLE_FALSE.') '.
81
82
' OR (h.status='.HOST_STATUS_MONITORED.' AND h.available='.HOST_AVAILABLE_FALSE.' AND h.disable_until<='.$now.')) '.
82
83
' AND i.hostid=h.hostid '.
83
' AND i.nextcheck + 5 <'.$now.
84
/* ' AND i.nextcheck + 5 <'.$now.*/
84
85
' AND i.key_ NOT IN ('.zbx_dbstr('status').','.zbx_dbstr('icmpping').','.zbx_dbstr('icmppingsec').','.zbx_dbstr('zabbix[log]').') '.
85
86
' AND i.value_type not in ('.ITEM_VALUE_TYPE_LOG.') '.
86
87
' AND '.DBcondition('h.hostid',$available_hosts).
87
88
' AND '.DBin_node('h.hostid', get_current_nodeid()).
88
' ORDER BY i.nextcheck,h.host,i.description,i.key_');
89
' ORDER BY i.lastclock,h.host,i.description,i.key_');
90
91
$table = new CTableInfo(S_THE_QUEUE_IS_EMPTY);
92
if($_REQUEST["show"]==0){
93
if($_REQUEST["config"]==0){
94
95
foreach($item_types as $type){
103
104
while($row=DBfetch($result)){
104
if($now-$row["nextcheck"]<=10) $sec_10[$row["type"]]++;
105
else if($now-$row["nextcheck"]<=30) $sec_30[$row["type"]]++;
106
else if($now-$row["nextcheck"]<=60) $sec_60[$row["type"]]++;
107
else if($now-$row["nextcheck"]<=300) $sec_300[$row["type"]]++;
108
else if($now-$row["nextcheck"]<=600) $sec_600[$row["type"]]++;
109
else $sec_rest[$row["type"]]++;
105
$nextcheck = is_null($row['lastclock']) ? 0 : calculate_item_nextcheck($row['itemid'], $row['type'],
106
$row['delay'], $row['delay_flex'], $row['lastclock']);
107
$diff = $now - $nextcheck;
111
if ($diff <= 10) $sec_10[$row['type']]++;
112
else if ($diff <= 30) $sec_30[$row['type']]++;
113
else if ($diff <= 60) $sec_60[$row['type']]++;
114
else if ($diff <= 300) $sec_300[$row['type']]++;
115
else if ($diff <= 600) $sec_600[$row['type']]++;
116
else $sec_rest[$row['type']]++;
148
155
while ($row = DBfetch($result))
150
$diff = $now - $row['nextcheck'];
157
$nextcheck = is_null($row['lastclock']) ? 0 : calculate_item_nextcheck($row['itemid'], $row['type'],
158
$row['delay'], $row['delay_flex'], $row['lastclock']);
159
$diff = $now - $nextcheck;
152
163
if ($diff <= 10) $sec_10[$row['proxy_hostid']]++;
153
164
else if ($diff <= 30) $sec_30[$row['proxy_hostid']]++;
186
197
$table->addRow($elements);
188
else if ($_REQUEST["show"] == 2)
199
else if ($_REQUEST["config"] == 2)
190
203
$table->SetHeader(array(
192
205
is_show_subnodes() ? S_NODE : null,
196
209
while($row=DBfetch($result)){
210
$nextcheck = is_null($row['lastclock']) ? 0 : calculate_item_nextcheck($row['itemid'], $row['type'],
211
$row['delay'], $row['delay_flex'], $row['lastclock']);
212
$diff = $now - $nextcheck;
216
array_push($arr, array($nextcheck, $row['hostid'], $row['host'], item_description($row)));
197
221
$table->AddRow(array(
198
222
date("m.d.Y H:i:s",
200
get_node_name_by_elid($row['hostid']),
202
item_description($row)
224
get_node_name_by_elid($r[1]),
209
if($_REQUEST["show"]!=0){
233
if($_REQUEST["config"]!=0){
210
234
show_table_header(S_TOTAL.": ".$table->GetNumRows());