I got fed up one by one implementing the changes to Zabbix after upgrade - here is my patch.
It implements 3 patches I've provided to this forum:
- graph/screen timeline zoom; added 30h and 5d + tidy up the format of timeline
- IT SLA reports adds option "last_month" (only in en_gb.locale), other language variants omitted
- Add company logo from logo.php to upper right of every graph
- Add snmp_builder.php to Configuration-menu (download and install snmp_builder separately)
* Save below code as jhgrc_zabbix.patch (instructions continued after the patch)
* copy frontend/php to place accessible to your web server (as normal) and change directory (cd) to the newly generated directory.
* run patch in dry-run-mode to see if it goes without an error
- seems ok as no errors
* run patch without dry-run (-b option generates backup of patched files)
* Enjoy the enhanced Zabbix front-end again (At least I will)
- Now every front-end update is a easy task
It implements 3 patches I've provided to this forum:
- graph/screen timeline zoom; added 30h and 5d + tidy up the format of timeline
- IT SLA reports adds option "last_month" (only in en_gb.locale), other language variants omitted
- Add company logo from logo.php to upper right of every graph
- Add snmp_builder.php to Configuration-menu (download and install snmp_builder separately)
* Save below code as jhgrc_zabbix.patch (instructions continued after the patch)
Code:
diff -ru zabbix_1_8_2_orig/include/classes/class.cgraphdraw.php zabbix_1_8_2/include/classes/class.cgraphdraw.php
--- zabbix_1_8_2_orig/include/classes/class.cgraphdraw.php 2010-03-29 17:22:45.000000000 +0000
+++ zabbix_1_8_2/include/classes/class.cgraphdraw.php 2010-04-15 12:39:00.000000000 +0000
@@ -274,7 +274,15 @@
}
public function drawLogo(){
- imagestringup($this->im,0,$this->fullSizeX-10,$this->fullSizeY-50, 'http://www.zabbix.com', $this->getColor('Gray'));
+ //imagestringup($this->im,0,$this->fullSizeX-10,$this->fullSizeY-50, 'http://www.zabbix.com', $this->getColor('Gray'));
+ // Add the company logo
+ $stamp = imagecreatefrompng('logo.png');
+ $sx = imagesx($stamp);
+ $sy = imagesy($stamp);
+ $marge_right = 1;
+ $marge_bottom = 30;
+ //imagecopy($this->im, $stamp, imagesx($this->im) - $sx - $marge_right, imagesy($this->im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
+ imagecopy($this->im, $stamp, imagesx($this->im) - $sx - $marge_right, $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp));
}
public function getColor($color,$alfa=50){
diff -ru zabbix_1_8_2_orig/include/locales/en_gb.inc.php zabbix_1_8_2/include/locales/en_gb.inc.php
--- zabbix_1_8_2_orig/include/locales/en_gb.inc.php 2010-03-29 17:22:44.000000000 +0000
+++ zabbix_1_8_2/include/locales/en_gb.inc.php 2010-04-15 12:23:01.000000000 +0000
@@ -1498,6 +1498,7 @@
'S_LAST_24_HOURS'=> 'Last 24 hours',
'S_LAST_7_DAYS'=> 'Last 7 days',
'S_LAST_30_DAYS'=> 'Last 30 days',
+ 'S_LAST_MONTH'=> 'Last month',
'S_LAST_365_DAYS'=> 'Last 365 days',
'S_CANNOT_FORMAT_TREE_CHECK_LOGIC'=> 'Cannot format Tree. Check logic structure in service links',
diff -ru zabbix_1_8_2_orig/include/menu.inc.php zabbix_1_8_2/include/menu.inc.php
--- zabbix_1_8_2_orig/include/menu.inc.php 2010-03-29 17:22:45.000000000 +0000
+++ zabbix_1_8_2/include/menu.inc.php 2010-04-15 12:33:14.000000000 +0000
@@ -167,7 +167,8 @@
array( 'url' => 'export.php',
'label' => S_EXPORT_IMPORT,
'sub_pages'=>array('import.php')
- )
+ ),
+ array('url' => 'snmp_builder.php', 'label' => 'SNMP builder')
)
),
'admin'=>array(
diff -ru zabbix_1_8_2_orig/js/gtlc.js zabbix_1_8_2/js/gtlc.js
--- zabbix_1_8_2_orig/js/gtlc.js 2010-03-29 17:22:44.000000000 +0000
+++ zabbix_1_8_2/js/gtlc.js 2010-04-15 12:18:56.000000000 +0000
@@ -1501,7 +1501,7 @@
var timeline = this.timeline.endtime() - this.timeline.starttime();
var caption = '';
- var zooms = [3600, (2*3600), (3*3600), (6*3600), (12*3600), 86400, (7*86400), (14*86400), (30*86400), (90*86400), (180*86400), (365*86400)];
+ var zooms = [3600, (2*3600), (3*3600), (6*3600), (12*3600), 86400, (30*3600), (5*86400), (7*86400), (14*86400), (30*86400), (90*86400), (180*86400), (365*86400)];
var links = 0;
for(var key in zooms){
@@ -1509,7 +1509,7 @@
if((timeline / zooms[key]) < 1) break;
caption = this.formatStampByDHM(zooms[key], false, true);
- caption = caption.split(' ',2)[0];
+ caption = caption.split(' 0',2)[0].split(' ').join('');
this.dom.linklist[links] = document.createElement('span');
this.dom.links.appendChild(this.dom.linklist[links]);
diff -ru zabbix_1_8_2_orig/srv_status.php zabbix_1_8_2/srv_status.php
--- zabbix_1_8_2_orig/srv_status.php 2010-03-29 17:22:45.000000000 +0000
+++ zabbix_1_8_2/srv_status.php 2010-04-15 12:24:26.000000000 +0000
@@ -97,6 +97,7 @@
24 => S_LAST_24_HOURS,
24*7 => S_LAST_7_DAYS,
24*30 => S_LAST_30_DAYS,
+ 'last_month' => S_LAST_MONTH,
24*365 => S_LAST_365_DAYS,
);
@@ -113,6 +114,10 @@
case 'month':
$period_start = mktime(0, 0, 0, date('n'), 1, date('Y'));
break;
+ case 'last_month':
+ $period_end = mktime(0, 0, 0, date('n'), 1, date('Y'));
+ $period_start = mktime(0, 0, 0, (date('n')-1)<1?12:(date('n')-1),1, (date('n')-1)<1?(date('Y')-1):date('Y'));
+ break;
case 'year':
$period_start = mktime(0, 0, 0, 1, 1, date('Y'));
break;
* run patch in dry-run-mode to see if it goes without an error
# patch -p1 -b --dry-run < jhgrc_zabbix.patch
patching file include/classes/class.cgraphdraw.php
patching file include/locales/en_gb.inc.php
patching file include/menu.inc.php
patching file js/gtlc.js
patching file srv_status.php
patching file include/classes/class.cgraphdraw.php
patching file include/locales/en_gb.inc.php
patching file include/menu.inc.php
patching file js/gtlc.js
patching file srv_status.php
* run patch without dry-run (-b option generates backup of patched files)
# patch -p1 -b < jhgrc_zabbix.patch
patching file include/classes/class.cgraphdraw.php
patching file include/locales/en_gb.inc.php
patching file include/menu.inc.php
patching file js/gtlc.js
patching file srv_status.php
patching file include/classes/class.cgraphdraw.php
patching file include/locales/en_gb.inc.php
patching file include/menu.inc.php
patching file js/gtlc.js
patching file srv_status.php
- Now every front-end update is a easy task
How should I check where the problem is?
Comment