Ad Widget

Collapse

IT Services per Month

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blokje
    Junior Member
    • Apr 2008
    • 9

    #1

    IT Services per Month

    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.
    Attached Files
  • welkin
    Senior Member
    • Mar 2007
    • 132

    #2
    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

    Comment

    • blokje
      Junior Member
      • Apr 2008
      • 9

      #3
      Originally posted by welkin
      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)));
      Last edited by blokje; 19-03-2009, 16:43.

      Comment

      • flexguy
        Junior Member
        • Sep 2008
        • 19

        #4
        should be integrated in the next version, Alexei?

        have a look at this:

        Comment

        • dotneft
          Senior Member
          • Nov 2008
          • 699

          #5
          not show more than three addictions

          Comment

          • aigars
            Member
            • Apr 2010
            • 55

            #6
            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.

            Comment

            • blokje
              Junior Member
              • Apr 2008
              • 9

              #7
              Originally posted by aigars
              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.

              Comment

              • billjam
                Junior Member
                • Jan 2009
                • 27

                #8
                any updated version

                I know, its an old post but I don't see much activity on SLA front.
                Any patches for "last month" or specified date range for SLA?

                Comment

                • MrKen
                  Senior Member
                  • Oct 2008
                  • 652

                  #9
                  Since Zabbix 1.6.6, IT_Services can be filtered as follows:

                  Today
                  This week
                  This month
                  This year
                  Last 24 hours
                  Last 7 days
                  Last 30 days
                  Last 365 days


                  MrKen
                  Disclaimer: All of the above is pure speculation.

                  Comment

                  Working...