OpenNMS API 1.2.3

org.opennms.report.availability
Class AvailCalculations

java.lang.Object
  extended byorg.opennms.report.availability.AvailCalculations

public class AvailCalculations
extends java.lang.Object

AvailCalculations does all computations for all reports for a category. The types include Last 30 days daily availability Last 30 days total availability Last 30 days daily service availability Last Months Top 20 offenders Last Months Top 20 Service outages Last N Months Availability Last Months Daily Availability Last Months Total Availability Last Months Daily Service Availability Month To Date Daily Availability Month To Date Total Availability

Author:
Jacinta Remedios , Oculan

Field Summary
private static java.lang.String LOG4J_CATEGORY
          The log4j category used to log debug messsages and statements.
private  int m_daysInLastMonth
          Number of days in the last month.
private  long m_endLastMonthTime
          End time of the last month.
private  long m_endTime
          End time
private  java.lang.String m_format
          Report Format
private  java.util.List m_monitoredServices
          Monitored Services for the category
private  java.util.List m_nodes
          Nodes that match this category.
private static Report m_report
          Castor object that holds all the information required for the generating xml to be translated to the pdf.
private  int m_sectionIndex
          This is used for the PDF Report generation
private  java.util.Map m_services
          Services map
private static int NMONTHS
          Constant (Number of months)
private static long ROLLING_WINDOW
          The time in milliseconds per day.
private static int THIRTY
          Constant
 
Constructor Summary
AvailCalculations(java.util.List nodes, long endTime, long lastMonthEndTime, java.util.List monitoredServices, Report report, java.util.TreeMap offenders, double warning, double normal, java.lang.String comments, java.lang.String name, java.lang.String format, int catIndex, int sectionIndex)
          Constructor
 
Method Summary
private  java.lang.String formatNumber(java.lang.String num)
          Format the number (String) and return 6 digits of the number
private static int getDays(boolean isLeap, int month)
          Returns the number of days in the month, also considers checks for leap year.
private  int getDaysForMonth(long endTime)
          Returns the number of Days in the month
 int getSectionIndex()
           
private  void lastMoDailyAvailability(int days, long endTime, CatSections sections, java.lang.String label, java.lang.String descr, java.lang.String sectionName)
          Last Months Daily availability
private  void lastMonTopNServiceOutages(CatSections catSections, java.lang.String label, java.lang.String descr)
          Last Months Top N Service Outages.
private  void lastMoTopNOffenders(java.util.TreeMap offenders, CatSections catSections, java.lang.String label, java.lang.String descr)
          Last Months Top N offenders.
private  void lastMoTotalAvailability(int days, long endTime, CatSections catSections, java.lang.String label, java.lang.String descr)
          Last N Days Total Availability.
private  void lastMTDDailyAvailability(int days, long endTime, CatSections sections, java.lang.String label, java.lang.String descr, java.lang.String sectionName)
          Last Month To Date Daily Availability
private  void lastNDaysDailyAvailability(int days, long endTime, CatSections catSections, java.lang.String label, java.lang.String descr, java.lang.String sectionName)
          Last N days daily availability.
private  void lastNDaysDailyServiceAvailability(int days, long endTime, CatSections catSections, java.lang.String label, java.lang.String descr)
          Compute N days daily service availability.
private  void lastNDaysTotalAvailability(int days, long endTime, CatSections catSections, java.lang.String label, java.lang.String descr)
          Last N Days Total Availability.
private  void lastNMonthsAvailability(int nMonths, long endTime, CatSections catSections, java.lang.String label, java.lang.String descr)
          Last N Months Availability
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG4J_CATEGORY

private static final java.lang.String LOG4J_CATEGORY
The log4j category used to log debug messsages and statements.

See Also:
Constant Field Values

m_report

private static Report m_report
Castor object that holds all the information required for the generating xml to be translated to the pdf.


m_endTime

private long m_endTime
End time


m_services

private java.util.Map m_services
Services map


m_endLastMonthTime

private long m_endLastMonthTime
End time of the last month.


m_daysInLastMonth

private int m_daysInLastMonth
Number of days in the last month.


ROLLING_WINDOW

private static final long ROLLING_WINDOW
The time in milliseconds per day.

See Also:
Constant Field Values

THIRTY

private static final int THIRTY
Constant

See Also:
Constant Field Values

NMONTHS

private static final int NMONTHS
Constant (Number of months)

See Also:
Constant Field Values

m_nodes

private java.util.List m_nodes
Nodes that match this category.


m_monitoredServices

private java.util.List m_monitoredServices
Monitored Services for the category


m_format

private java.lang.String m_format
Report Format


m_sectionIndex

private int m_sectionIndex
This is used for the PDF Report generation

Constructor Detail

AvailCalculations

public AvailCalculations(java.util.List nodes,
                         long endTime,
                         long lastMonthEndTime,
                         java.util.List monitoredServices,
                         Report report,
                         java.util.TreeMap offenders,
                         double warning,
                         double normal,
                         java.lang.String comments,
                         java.lang.String name,
                         java.lang.String format,
                         int catIndex,
                         int sectionIndex)
Constructor

Parameters:
nodes - List of nodes
endTime - End time ( end of yesterday in milliseconds)
lastMonthEndTime - Last months end time (end of the last day of last month in milliseconds)
monitoredServices - Monitored services belonging to the category.
report - Castor Report class.
offenders - Map of all offenders -- percent/(list of node) pairs
format - Value can be "SVG / all"
Method Detail

getSectionIndex

public int getSectionIndex()

lastMonTopNServiceOutages

private void lastMonTopNServiceOutages(CatSections catSections,
                                       java.lang.String label,
                                       java.lang.String descr)
Last Months Top N Service Outages.

Parameters:
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

lastMTDDailyAvailability

private void lastMTDDailyAvailability(int days,
                                      long endTime,
                                      CatSections sections,
                                      java.lang.String label,
                                      java.lang.String descr,
                                      java.lang.String sectionName)
Last Month To Date Daily Availability

Parameters:
days - Number of days for which the availability computations are made.
endTime - End time
sections - Castors sections
label - Section name in the xml
descr - Section descr.
sectionName - Section name.

lastMoTotalAvailability

private void lastMoTotalAvailability(int days,
                                     long endTime,
                                     CatSections catSections,
                                     java.lang.String label,
                                     java.lang.String descr)
Last N Days Total Availability.

Parameters:
days - Number of days for which the availability computations are made.
endTime - End time
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

lastMoTopNOffenders

private void lastMoTopNOffenders(java.util.TreeMap offenders,
                                 CatSections catSections,
                                 java.lang.String label,
                                 java.lang.String descr)
Last Months Top N offenders.

Parameters:
offenders - Top Offenders
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

lastMoDailyAvailability

private void lastMoDailyAvailability(int days,
                                     long endTime,
                                     CatSections sections,
                                     java.lang.String label,
                                     java.lang.String descr,
                                     java.lang.String sectionName)
Last Months Daily availability

Parameters:
days - Number of days for which the availability computations are made
endTime - End time
sections - Castors sections
label - Section name in the xml
descr - Section descr.
sectionName - Section name

lastNDaysDailyAvailability

private void lastNDaysDailyAvailability(int days,
                                        long endTime,
                                        CatSections catSections,
                                        java.lang.String label,
                                        java.lang.String descr,
                                        java.lang.String sectionName)
Last N days daily availability.

Parameters:
days - Number of days for which the availability computations are made.
endTime - End time
catSections - Castors sections
label - Section name in the xml
descr - Section descr.
sectionName - Section name

lastNDaysTotalAvailability

private void lastNDaysTotalAvailability(int days,
                                        long endTime,
                                        CatSections catSections,
                                        java.lang.String label,
                                        java.lang.String descr)
Last N Days Total Availability.

Parameters:
days - Number of days for which the availability computations are made.
endTime - End time
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

lastNMonthsAvailability

private void lastNMonthsAvailability(int nMonths,
                                     long endTime,
                                     CatSections catSections,
                                     java.lang.String label,
                                     java.lang.String descr)
Last N Months Availability

Parameters:
nMonths - Number of months for which the availability computations are made.
endTime - End time
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

getDays

private static int getDays(boolean isLeap,
                           int month)
Returns the number of days in the month, also considers checks for leap year.

Parameters:
isLeap - the leap year flag.
month - The month whose days count is reqd

getDaysForMonth

private int getDaysForMonth(long endTime)
Returns the number of Days in the month

Parameters:
endTime - The end of the month (time in milliseconds)

lastNDaysDailyServiceAvailability

private void lastNDaysDailyServiceAvailability(int days,
                                               long endTime,
                                               CatSections catSections,
                                               java.lang.String label,
                                               java.lang.String descr)
Compute N days daily service availability.

Parameters:
endTime - End time
catSections - Castors sections
label - Section name in the xml
descr - Section descr.

formatNumber

private java.lang.String formatNumber(java.lang.String num)
Format the number (String) and return 6 digits of the number


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.