As I need to get IT services states per month I've created a patch file with some adjustments to create an report with IT SLA overview's per month.
I've build this on Zabbix 1.6.2 frontend. For me it is working if it is working for you I don't know. It creates a few files and alters the include/page_header.php file.
As Zabbix is OSS I'm publishing my patch under the same license agreement.
Please let me know what you think about it.
Zabbix is a great product but is lacking some minor functions sometimes, like IT services overview per month. Maybe something for the developers to include in a next release. It was not that much of a work and I saw requests for this functionality a few times on the boards.
sounds great but what a about per year? many contracts are signed with a sla period of one year so zabbix should honor this fact.
regards
welkin
A friend of mine also suggested this. I did this in just a day or a half of it when I count my coffee breaks out of it. So it should be easily do-able. I'll take a look at it later on today.
Update
Another patch set which you can apply to the other patch. This will add the feature for year views.
Code:
diff -ruN zabbix.bck/chart_sla2.php zabbix/chart_sla2.php
--- zabbix.bck/chart_sla2.php 2009-03-18 11:30:44.000000000 +0100
+++ zabbix/chart_sla2.php 2009-03-19 15:41:05.000000000 +0100
@@ -80,13 +80,20 @@
ImageFilledRectangle($im,0,0,$sizeX,$sizeY,ImageColorAllocate($im,120,200,120));
$now=time(NULL);
- // Start is: first day of the month
- $period_start=mktime(0,0,0,$month,1,$year);
- // Stop is last day of the month
- $period_end=mktime(0,0,0,$month+1,1,$year);
+ if($month==0)
+ {
+ $period_start=mktime(0,0,0,1,1,$year);
+ $period_end =mktime(0,0,0,1,1,$year+1);
+ }
+ else
+ {
+ // Start is: first day of the month
+ $period_start=mktime(0,0,0,$month,1,$year);
+ // Stop is last day of the month
+ $period_end=mktime(0,0,0,$month+1,1,$year);
+ }
if($period_end>time())
$period_end=time();
-
$stat=calculate_service_availability($_REQUEST["serviceid"],$period_start,$period_end);
$problem=$stat["problem"];
diff -ruN zabbix.bck/srv_status2.php zabbix/srv_status2.php
--- zabbix.bck/srv_status2.php 2009-03-19 12:40:23.000000000 +0100
+++ zabbix/srv_status2.php 2009-03-19 15:39:03.000000000 +0100
@@ -84,6 +84,7 @@
}
$cmbMonth = new CComboBox("month",$month,"submit()");
+ $cmbMonth->AddItem(0,S_ALL_SMALL);
if($year<date('Y'))
{
$maxmonth=12;
@@ -104,6 +105,10 @@
$from='1/'.$month.'/'.$year;
$to =date('t',mktime(1,1,1,$month,1,$year)).'/'.$month.'/'.$year;
$HeaderTitle=S_TIME_PERIOD . " (" . $from . " - " . $to . ")";
+ if($month==0)
+ {
+ $HeaderTitle=S_TIME_PERIOD . " (Year: " . $year . ")";
+ }
$menu = get_table_header($HeaderTitle,$form);
//--------
@@ -208,19 +213,27 @@
if($row["showsla"]==1){
# SLA Bar
+ $period=(($month==0)?'yearly':'monthly');
$row['sla'] = new CLink(new CImg("chart_sla2.php?serviceid=".$row["serviceid"]."&year=" . $year . "&month=" . $month),
- "report3.php?serviceid=".$row["serviceid"]."&period=monthly&year=".$year);
+ "report3.php?serviceid=".$row["serviceid"]."&period=" . $period . "&year=".$year);
#$now = time(NULL);
#$period_start = $now-7*24*3600;
#$period_end = $now;
#$period_start=$now-7*86400;
#$period_end=$now;
- // Start is: first day of the month
- $period_start=mktime(0,0,0,$month,1,$year);
- // Stop is last day of the month
- $period_end=mktime(0,0,0,$month+1,1,$year);
-
+ if($month==0)
+ {
+ $period_start=mktime(0,0,0,1,1,$year);
+ $period_end=mktime(0,0,0,1,1,$year+1);
+ }
+ else
+ {
+ // Start is: first day of the month
+ $period_start=mktime(0,0,0,$month,1,$year);
+ // Stop is last day of the month
+ $period_end=mktime(0,0,0,$month+1,1,$year);
+ }
if($period_end>time())
$period_end=time();
$stat = calculate_service_availability($row["serviceid"],$period_start,$period_end);
@@ -263,7 +276,7 @@
'status' => bold(S_STATUS),
'reason' => bold(S_REASON),
'sla' => bold(S_SLA_LAST_7_DAYS),
- 'sla' => bold('SLA (this month)'),
+ 'sla' => bold('SLA'),
'sla2' => bold(nbsp(S_SLA)),
'graph' => bold(S_GRAPH)));
Sorry for stupid question I'm not familiar with linux and Zabbix, yet. But I'm trying... How can I applied this patch to my existing Zabbix installation?
Thanks.
Sorry for stupid question I'm not familiar with linux and Zabbix, yet. But I'm trying... How can I applied this patch to my existing Zabbix installation?
Thanks.
You can apply this with patch
Code:
patch < input.patch.file.patch
As this patch has been based for zabbix 1.6.2 I will not guarantee that it will work with your installation.