Added new dashboard widgets

This commit is contained in:
Enrique Martin 2023-12-05 12:11:25 +01:00
parent e833499dc3
commit 2d1b2bf6d2
3 changed files with 167 additions and 34 deletions

View File

@ -274,24 +274,24 @@ group[37]="Networking"
oid[1]=".1.3.6.1.4.1.9.9.41.1.2.3.1.2.0"
value[1]="RANDOM;0;100"
snmp_type[1]="6"
chance_percent[1]="30"
chance_percent[1]="20"
oid[2]=".1.3.6.1.4.1.9.9.41.1.2.3.1.3.0"
value[2]="RANDOM;0;100"
snmp_type[2]="6"
chance_percent[2]="30"
chance_percent[2]="20"
oid[3]=".1.3.6.1.4.1.9.9.41.1.2.3.1.4.0"
value[3]="RANDOM;0;100"
snmp_type[3]="6"
chance_percent[3]="30"
chance_percent[3]="20"
oid[4]=".1.3.6.1.4.1.9.9.41.1.2.3.1.5.0"
value[4]="RANDOM;0;100"
snmp_type[4]="6"
chance_percent[4]="30"
chance_percent[4]="20"
oid[5]=".1.3.6.1.4.1.9.9.41.1.2.3.1.6.0"
value[5]="RANDOM;0;100"
snmp_type[5]="6"
chance_percent[5]="30"
chance_percent[5]="20"

View File

@ -5,39 +5,61 @@ group="Demo dashboard"
[dashboard_items]
title[1]="Agents sunburst"
type[1]="service_map"
service_name[1]="Sunburst service"
title[1]="Groups status"
type[1]="system_group_status"
x[1]="0"
y[1]="0"
width[1]="6"
height[1]="10"
show_sunburst[1]=true
width[1]="5"
height[1]="4"
title[2]="Linux CPU Load"
type[2]="custom_graph"
graph_name[2]="Linux CPU Load"
x[2]="6"
title[2]="Network map"
type[2]="network_map"
x[2]="5"
y[2]="0"
width[2]="6"
height[2]="5"
graph_type[2]="s_area"
interval[2]="86400"
width[2]="7"
height[2]="6"
map_name[2]="Demo sunburst network map"
title[3]="Linux Disk Usage"
type[3]="custom_graph"
graph_name[3]="Linux Disk Usage"
x[3]="6"
y[3]="5"
width[3]="6"
height[3]="5"
graph_type[3]="line"
title[3]="Module histogram"
type[3]="graph_module_histogram"
x[3]="0"
y[3]="4"
width[3]="5"
height[3]="2"
agent_name[3]="demo-global-agent-1"
module[3]="Host Alive"
interval[3]="86400"
title[4]="Network map"
type[4]="network_map"
map_name[4]="Demo network map"
title[4]="List of latest events"
type[4]="events_list"
x[4]="0"
y[4]="10"
y[4]="6"
width[4]="12"
height[4]="10"
height[4]="5"
title[5]="Top N events by agent"
type[5]="top_n_events_by_group"
x[5]="6"
y[5]="11"
width[5]="6"
height[5]="8"
title[6]="Top N of agent modules"
type[6]="top_n"
x[6]="0"
y[6]="11"
width[6]="6"
height[6]="4"
agent_name[6]="cisco-.*"
module[6]=".*ifOutOctets"
interval[6]="86400"
title[7]="Top N of agent modules"
type[7]="top_n"
x[7]="0"
y[7]="15"
width[7]="6"
height[7]="4"
agent_name[7]="cisco-.*"
module[7]=".*ifInOctets"
interval[7]="86400"

View File

@ -2925,7 +2925,7 @@ if ($action === 'create_demo_data') {
'agentId' => "$agent_id",
'metaconsoleId' => 0,
'moduleId' => "$module_id",
'period' => (isset($items_array['interval']) === false) ? $items_array['interval'] : '86400',
'period' => (isset($items_array['interval']) === true) ? $items_array['interval'] : '86400',
'showLegend' => 1,
'projection_switch' => false,
'period_projection' => '300',
@ -2972,7 +2972,7 @@ if ($action === 'create_demo_data') {
'background' => '#ffffff',
'id_graph' => $id_graph,
'type' => $graph_type_id,
'period' => (isset($items_array['interval']) === false) ? $items_array['interval'] : 86400,
'period' => (isset($items_array['interval']) === true) ? $items_array['interval'] : 86400,
'showLegend' => 1,
];
@ -3048,6 +3048,117 @@ if ($action === 'create_demo_data') {
$order++;
}
if ($items_array['type'] === 'system_group_status') {
$options_data = [
'title' => $title,
'background' => '#ffffff',
'groupId' => ["0"],
'status' => ["4,1,0,2"],
'sunburst' => false,
];
$order++;
}
if ($items_array['type'] === 'graph_module_histogram') {
if (isset($items_array['agent_name']) === false
|| isset($items_array['module']) === false
) {
// The above fields are required for this item.
continue;
}
$matched_agents = agents_get_agents(
['nombre' => $items_array['agent_name']],
['id_agente'],
'AR',
[
'field' => 'nombre',
'order' => 'ASC',
],
false,
0,
false,
false,
false
);
$agent_id = $matched_agents[0]['id_agente'];
if (!($agent_id > 0)) {
continue;
}
$module_row = modules_get_agentmodule_id(io_safe_input($items_array['module']), $agent_id);
$module_id = $module_row['id_agente_modulo'];
if (!($module_id > 0)) {
continue;
}
$options_data = [
'title' => $title,
'background' => '#ffffff',
'agentId' => "$agent_id",
'metaconsoleId' => 0,
'moduleId' => "$module_id",
'period' => (isset($items_array['interval']) === true) ? $items_array['interval'] : '86400',
'sizeLabel' => 30
];
$order++;
}
if ($items_array['type'] === 'events_list') {
$options_data = [
'title' => $title,
'background' => '#ffffff',
'eventType' => 0,
'maxHours' => 8,
'limit' => 20,
'eventStatus' => -1,
'severity' => -1,
'groupId' => [""],
'tagsId' => [""],
'groupRecursion' => 0,
'customFilter' => -1,
'columns_events_widget' => ["mini_severity,evento,estado,agent_name,timestamp", ""]
];
$order++;
}
if ($items_array['type'] === 'top_n_events_by_group') {
$options_data = [
'title' => $title,
'background' => '#ffffff',
'amountShow' => 10,
'maxHours' => 8,
'groupId' => ["0"],
'legendPosition' => "bottom",
'show_total_data' => 0
];
$order++;
}
if ($items_array['type'] === 'top_n') {
$options_data = [
'title' => $title,
'background' => '#ffffff',
'agent' => (isset($items_array['agent_name']) === true) ? $items_array['agent_name'] : '.*',
'module' => (isset($items_array['module']) === true) ? $items_array['module'] : '.*',
'period' => (isset($items_array['interval']) === true) ? $items_array['interval'] : '86400',
'quantity' => '10',
'order' => '2',
'display' => '0',
'type_graph' => 'bar_vertical',
'legend' => 'agent_module'
];
$order++;
}
$item_x = $items_array['x'];
$item_y = $items_array['y'];
$item_width = $items_array['width'];