'top_hosts_trap_text', 'key_' => 'top_hosts_trap_text', 'hostid' => 10084, 'type' => 2, 'value_type' => 4 ], [ 'name' => 'top_hosts_trap_log', 'key_' => 'top_hosts_trap_log', 'hostid' => 10084, 'type' => 2, 'value_type' => 2 ], [ 'name' => 'top_hosts_trap_char', 'key_' => 'top_hosts_trap_char', 'hostid' => 10084, 'type' => 2, 'value_type' => 1 ] ]); self::$itemids = CDataHelper::getIds('name'); // Add value to item displayed in Top Hosts widget. CDataHelper::addItemData(99086, 1000); CDataHelper::addItemData(self::$itemids['top_hosts_trap_text'], 'Text for text item'); CDataHelper::addItemData(self::$itemids['top_hosts_trap_log'], 'Logs for text item'); CDataHelper::addItemData(self::$itemids['top_hosts_trap_char'], 'characters_here'); // Create dashboards for Top host widget testing. CDataHelper::call('dashboard.create', [ [ 'name' => 'top_host_update', 'display_period' => 30, 'auto_start' => 1, 'pages' => [ [ 'name' => '', 'widgets' => [ [ 'type' => 'tophosts', 'name' => 'Top hosts update', 'x' => 0, 'y' => 0, 'width' => 12, 'height' => 8, 'view_mode' => 0, 'fields' => [ [ 'type' => 1, 'name' => 'columns.name.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.data.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.item.0', 'value' => 'Available memory' ], [ 'type' => 1, 'name' => 'columns.timeshift.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.aggregate_function.0', 'value' => 0 ], [ 'type' => 0, 'name' => 'columns.decimal_places.0', 'value' => 4 ], [ 'type' => 0, 'name' => 'columns.display.0', 'value' => 1 ], [ 'type' => 0, 'name' => 'columns.history.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.base_color.0', 'value' => '' ], [ 'type' => 0, 'name' => 'column', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.name.1', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.data.1', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.item.1', 'value' => 'Available memory in %' ], [ 'type' => 1, 'name' => 'columns.timeshift.1', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.aggregate_function.1', 'value' => 0 ], [ 'type' => 0, 'name' => 'columns.decimal_places.1', 'value' => 2 ], [ 'type' => 0, 'name' => 'columns.display.1', 'value' => 1 ], [ 'type' => 0, 'name' => 'columns.history.1', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.base_color.1', 'value' => '' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.1.0', 'value' => 'FF465C' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.1.0', 'value' => '100' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.1.1', 'value' => 'B0AF07' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.1.1', 'value' => '600' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.0.0', 'value' => 'FF465C' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.0.0', 'value' => '100' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.0.1', 'value' => 'B0AF07' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.0.1', 'value' => '600' ] ] ] ] ] ] ], [ 'name' => 'top_host_create', 'display_period' => 30, 'auto_start' => 1, 'pages' => [[]] ], [ 'name' => 'top_host_delete', 'display_period' => 30, 'auto_start' => 1, 'pages' => [ [ 'name' => '', 'widgets' => [ [ 'type' => 'tophosts', 'name' => 'Top hosts delete', 'x' => 0, 'y' => 0, 'width' => 12, 'height' => 8, 'view_mode' => 0, 'fields' => [ [ 'type' => 1, 'name' => 'columns.name.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.data.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.item.0', 'value' => 'Available memory' ], [ 'type' => 1, 'name' => 'columns.timeshift.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.aggregate_function.0', 'value' => 0 ], [ 'type' => 0, 'name' => 'columns.display.0', 'value' => 1 ], [ 'type' => 0, 'name' => 'columns.history.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.base_color.0', 'value' => '' ], [ 'type' => 0, 'name' => 'column', 'value' => 0 ] ] ] ] ] ] ], [ 'name' => 'top_host_remove', 'display_period' => 30, 'auto_start' => 1, 'pages' => [ [ 'name' => '', 'widgets' => [ [ 'type' => 'tophosts', 'name' => 'Top hosts for remove', 'x' => 0, 'y' => 0, 'width' => 12, 'height' => 8, 'view_mode' => 0, 'fields' => [ [ 'type' => 1, 'name' => 'columns.name.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.data.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.item.0', 'value' => 'Available memory' ], [ 'type' => 1, 'name' => 'columns.timeshift.0', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.aggregate_function.0', 'value' => 0 ], [ 'type' => 0, 'name' => 'columns.display.0', 'value' => 1 ], [ 'type' => 0, 'name' => 'columns.history.0', 'value' => 1 ], [ 'type' => 1, 'name' => 'columns.base_color.0', 'value' => '' ], [ 'type' => 0, 'name' => 'column', 'value' => 0 ], [ 'type' => 1, 'name' => 'columns.name.1', 'value' => '' ], [ 'type' => 0, 'name' => 'columns.data.1', 'value' => 2 ], [ 'type' => 0, 'name' => 'columns.aggregate_function.1', 'value' => 0 ], [ 'type' => 1, 'name' => 'columns.base_color.1', 'value' => '' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.0.0', 'value' => 'FF465C' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.0.0', 'value' => '100' ], [ 'type' => 1, 'name' => 'columnsthresholds.color.0.1', 'value' => '4000FF' ], [ 'type' => 1, 'name' => 'columnsthresholds.threshold.0.1', 'value' => '1000' ], [ 'type' => 1, 'name' => 'tags.tag.0', 'value' => 'tag1' ], [ 'type' => 0, 'name' => 'tags.operator.0', 'value' => 0 ], [ 'type' => 1, 'name' => 'tags.value.0', 'value' => 'val1' ], [ 'type' => 1, 'name' => 'tags.tag.1', 'value' => 'tag2' ], [ 'type' => 0, 'name' => 'tags.operator.1', 'value' => 0 ], [ 'type' => 1, 'name' => 'tags.value.1', 'value' => 'val2' ] ] ] ] ] ] ], [ 'name' => 'top_host_screenshots', 'display_period' => 30, 'auto_start' => 1, 'pages' => [[]] ], [ 'name' => 'top_host_text_items', 'display_period' => 30, 'auto_start' => 1, 'pages' => [[]] ] ]); return [ 'dashboardids' => CDataHelper::getIds('name') ]; } }