Skip to content

Instantly share code, notes, and snippets.

@higebu
Last active December 11, 2015 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save higebu/4591912 to your computer and use it in GitHub Desktop.
Save higebu/4591912 to your computer and use it in GitHub Desktop.
Patch file for Zabbix2.0.4. Display all graphs of a host, when "not selected" is selected.
diff -u -r zabbix_orig/include/classes/screens/CScreenChart.php zabbix/include/classes/screens/CScreenChart.php
--- zabbix_orig/include/classes/screens/CScreenChart.php 2012-12-09 13:20:04.000000000 +0900
+++ zabbix/include/classes/screens/CScreenChart.php 2013-01-21 14:51:05.000000000 +0900
@@ -38,6 +38,7 @@
parent::__construct($options);
$this->graphid = isset($options['graphid']) ? $options['graphid'] : null;
+ $this->dataId = isset($options['dataId']) ? $options['dataId'] : null;
}
/**
@@ -46,7 +47,9 @@
* @return CDiv (screen inside container)
*/
public function get() {
- $this->dataId = 'graph_full';
+ if (empty($this->dataId)) {
+ $this->dataId = 'graph_full';
+ }
$containerId = 'graph_conteiner';
// time control
diff -u -r zabbix_orig/include/views/monitoring.charts.php zabbix/include/views/monitoring.charts.php
--- zabbix_orig/include/views/monitoring.charts.php 2012-12-09 13:19:58.000000000 +0900
+++ zabbix/include/views/monitoring.charts.php 2013-01-21 15:07:37.000000000 +0900
@@ -18,7 +18,6 @@
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
-
$chartsWidget = new CWidget('hat_charts');
$chartForm = new CForm('get');
$chartForm->addVar('fullscreen', $this->data['fullscreen']);
@@ -61,6 +60,34 @@
'profileIdx' => $screen->profileIdx
));
}
+else if ($this->data['pageFilter']->hostid != 0) {
+
+ $options = array(
+ 'output' => array('graphid', 'name', 'graphtype'),
+ 'hostids' => $this->data['pageFilter']->hostid
+ );
+ $graphs = API::Graph()->get($options);
+
+ $chartTable = new CTable(_('No graphs defined.'), 'maxwidth');
+ foreach ($graphs as $graph) {
+ $graphid = $graph['graphid'];
+ $screen = CScreenBuilder::getScreen(array(
+ 'resourcetype' => SCREEN_RESOURCE_CHART,
+ 'graphid' => $graph['graphid'],
+ 'profileIdx' => 'web.screens',
+ 'profileIdx2' => $graph['graphid'],
+ 'dataId' => 'graph_full_' . $graph['graphid']
+ ));
+ $chartTable->addRow($screen->get());
+ }
+
+ $chartsWidget->addItem($chartTable);
+
+ CScreenBuilder::insertScreenStandardJs(array(
+ 'timeline' => $screen->timeline,
+ 'profileIdx' => $screen->profileIdx
+ ));
+}
else {
$screen = new CScreenBuilder();
CScreenBuilder::insertScreenStandardJs(array(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment