001/*
002 * Copyright 2014-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.monitors;
022
023
024
025import java.util.Collections;
026import java.util.Date;
027import java.util.LinkedHashMap;
028import java.util.List;
029import java.util.Map;
030
031import com.unboundid.ldap.sdk.Entry;
032import com.unboundid.ldap.sdk.unboundidds.AlarmSeverity;
033import com.unboundid.util.NotExtensible;
034import com.unboundid.util.ThreadSafety;
035import com.unboundid.util.ThreadSafetyLevel;
036
037import static com.unboundid.ldap.sdk.unboundidds.monitors.MonitorMessages.*;
038
039
040
041/**
042 * This class defines the base class for gauge monitor entries, which provide
043 * information common to all types of gauges.  Subclasses may provide more
044 * specific information for that specific type of gauge.
045 * <BR>
046 * <BLOCKQUOTE>
047 *   <B>NOTE:</B>  This class, and other classes within the
048 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
049 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
050 *   server products.  These classes provide support for proprietary
051 *   functionality or for external specifications that are not considered stable
052 *   or mature enough to be guaranteed to work in an interoperable way with
053 *   other types of LDAP servers.
054 * </BLOCKQUOTE>
055 */
056@NotExtensible()
057@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
058public class GaugeMonitorEntry
059       extends MonitorEntry
060{
061  /**
062   * The base structural object class used in gauge monitor entries.
063   */
064  static final String GAUGE_MONITOR_OC = "ds-gauge-monitor-entry";
065
066
067
068  /**
069   * The serial version UID for this serializable class.
070   */
071  private static final long   serialVersionUID = -6092840651638645538L;
072
073
074
075  // The current severity for the gauge.
076  private final AlarmSeverity currentSeverity;
077
078  // The previous severity for the gauge.
079  private final AlarmSeverity previousSeverity;
080
081  // The time the gauge entered the current severity.
082  private final Date currentSeverityStartTime;
083
084  // The time the gauge last exited the critical state.
085  private final Date lastCriticalStateEndTime;
086
087  // The time the gauge last entered the critical state.
088  private final Date lastCriticalStateStartTime;
089
090  // The time the gauge last exited the major state.
091  private final Date lastMajorStateEndTime;
092
093  // The time the gauge last entered the major state.
094  private final Date lastMajorStateStartTime;
095
096  // The time the gauge last exited the minor state.
097  private final Date lastMinorStateEndTime;
098
099  // The time the gauge last entered the minor state.
100  private final Date lastMinorStateStartTime;
101
102  // The time the gauge last exited the normal state.
103  private final Date lastNormalStateEndTime;
104
105  // The time the gauge last entered the normal state.
106  private final Date lastNormalStateStartTime;
107
108  // The time the gauge last exited the warning state.
109  private final Date lastWarningStateEndTime;
110
111  // The time the gauge last entered the normal state.
112  private final Date lastWarningStateStartTime;
113
114  // The time the gauge information was initialized.
115  private final Date initTime;
116
117  // The time the gauge information was last updated.
118  private final Date updateTime;
119
120  // The error messages.
121  private final List<String> errorMessages;
122
123  // The current severity duration in milliseconds.
124  private final Long currentSeverityDurationMillis;
125
126  // The last critical state duration in milliseconds.
127  private final Long lastCriticalStateDurationMillis;
128
129  // The last major state duration in milliseconds.
130  private final Long lastMajorStateDurationMillis;
131
132  // The last minor state duration in milliseconds.
133  private final Long lastMinorStateDurationMillis;
134
135  // The last normal state duration in milliseconds.
136  private final Long lastNormalStateDurationMillis;
137
138  // The last warning state duration in milliseconds.
139  private final Long lastWarningStateDurationMillis;
140
141  // The number of samples taken in the current interval.
142  private final Long samplesThisInterval;
143
144  // The total critical state duration in milliseconds.
145  private final Long totalCriticalStateDurationMillis;
146
147  // The total major state duration in milliseconds.
148  private final Long totalMajorStateDurationMillis;
149
150  // The total minor state duration in milliseconds.
151  private final Long totalMinorStateDurationMillis;
152
153  // The total normal state duration in milliseconds.
154  private final Long totalNormalStateDurationMillis;
155
156  // The total warning state duration in milliseconds.
157  private final Long totalWarningStateDurationMillis;
158
159  // The string representation of the current severity duration.
160  private final String currentSeverityDurationString;
161
162  // The name for the gauge.
163  private final String gaugeName;
164
165  // The string representation of the last critical state duration.
166  private final String lastCriticalStateDurationString;
167
168  // The string representation of the last major state duration.
169  private final String lastMajorStateDurationString;
170
171  // The string representation of the last minor state duration.
172  private final String lastMinorStateDurationString;
173
174  // The string representation of the last normal state duration.
175  private final String lastNormalStateDurationString;
176
177  // The string representation of the last warning state duration.
178  private final String lastWarningStateDurationString;
179
180  // The resource for the gauge.
181  private final String resource;
182
183  // The resource type for the gauge.
184  private final String resourceType;
185
186  // The summary message.
187  private final String summary;
188
189  // The string representation of the total critical state duration.
190  private final String totalCriticalStateDurationString;
191
192  // The string representation of the total major state duration.
193  private final String totalMajorStateDurationString;
194
195  // The string representation of the total minor state duration.
196  private final String totalMinorStateDurationString;
197
198  // The string representation of the total normal state duration.
199  private final String totalNormalStateDurationString;
200
201  // The string representation of the total warning state duration.
202  private final String totalWarningStateDurationString;
203
204
205
206  /**
207   * Creates a new gauge monitor entry from the provided entry.
208   *
209   * @param  entry  The entry to be parsed as a gauge monitor entry.  It must
210   *                not be {@code null}.
211   */
212  public GaugeMonitorEntry(final Entry entry)
213  {
214    super(entry);
215
216    gaugeName = getString("gauge-name");
217    resource = getString("resource");
218    resourceType = getString("resource-type");
219
220    final String currentSeverityStr = getString("severity");
221    if (currentSeverityStr == null)
222    {
223      currentSeverity = null;
224    }
225    else
226    {
227      currentSeverity = AlarmSeverity.forName(currentSeverityStr);
228    }
229
230    final String previousSeverityStr = getString("previous-severity");
231    if (previousSeverityStr == null)
232    {
233      previousSeverity = null;
234    }
235    else
236    {
237      previousSeverity = AlarmSeverity.forName(previousSeverityStr);
238    }
239
240    summary = getString("summary");
241    errorMessages = getStrings("error-message");
242    initTime = getDate("gauge-init-time");
243    updateTime = getDate("update-time");
244    samplesThisInterval = getLong("samples-this-interval");
245
246    currentSeverityStartTime = getDate("current-severity-start-time");
247    currentSeverityDurationString = getString("current-severity-duration");
248    currentSeverityDurationMillis = getLong("current-severity-duration-millis");
249
250    lastNormalStateStartTime = getDate("last-normal-state-start-time");
251    lastNormalStateEndTime = getDate("last-normal-state-end-time");
252    lastNormalStateDurationString = getString("last-normal-state-duration");
253    lastNormalStateDurationMillis =
254         getLong("last-normal-state-duration-millis");
255    totalNormalStateDurationString = getString("total-normal-state-duration");
256    totalNormalStateDurationMillis =
257         getLong("total-normal-state-duration-millis");
258
259    lastWarningStateStartTime = getDate("last-warning-state-start-time");
260    lastWarningStateEndTime = getDate("last-warning-state-end-time");
261    lastWarningStateDurationString = getString("last-warning-state-duration");
262    lastWarningStateDurationMillis =
263         getLong("last-warning-state-duration-millis");
264    totalWarningStateDurationString = getString("total-warning-state-duration");
265    totalWarningStateDurationMillis =
266         getLong("total-warning-state-duration-millis");
267
268    lastMinorStateStartTime = getDate("last-minor-state-start-time");
269    lastMinorStateEndTime = getDate("last-minor-state-end-time");
270    lastMinorStateDurationString = getString("last-minor-state-duration");
271    lastMinorStateDurationMillis = getLong("last-minor-state-duration-millis");
272    totalMinorStateDurationString = getString("total-minor-state-duration");
273    totalMinorStateDurationMillis =
274         getLong("total-minor-state-duration-millis");
275
276    lastMajorStateStartTime = getDate("last-major-state-start-time");
277    lastMajorStateEndTime = getDate("last-major-state-end-time");
278    lastMajorStateDurationString = getString("last-major-state-duration");
279    lastMajorStateDurationMillis = getLong("last-major-state-duration-millis");
280    totalMajorStateDurationString = getString("total-major-state-duration");
281    totalMajorStateDurationMillis =
282         getLong("total-major-state-duration-millis");
283
284    lastCriticalStateStartTime = getDate("last-critical-state-start-time");
285    lastCriticalStateEndTime = getDate("last-critical-state-end-time");
286    lastCriticalStateDurationString = getString("last-critical-state-duration");
287    lastCriticalStateDurationMillis =
288         getLong("last-critical-state-duration-millis");
289    totalCriticalStateDurationString =
290         getString("total-critical-state-duration");
291    totalCriticalStateDurationMillis =
292         getLong("total-critical-state-duration-millis");
293  }
294
295
296
297  /**
298   * Retrieves the name for the gauge, if available.
299   *
300   * @return  The name for the gauge, or {@code null} if it was not included
301   *          in the monitor entry.
302   */
303  public final String getGaugeName()
304  {
305    return gaugeName;
306  }
307
308
309
310  /**
311   * Retrieves the resource for the gauge, if available.
312   *
313   * @return  The resource for the gauge, or {@code null} if it was not included
314   *          in the monitor entry.
315   */
316  public final String getResource()
317  {
318    return resource;
319  }
320
321
322
323  /**
324   * Retrieves the resource type for the gauge, if available.
325   *
326   * @return  The resource type for the gauge, or {@code null} if it was not
327   *          included in the monitor entry.
328   */
329  public final String getResourceType()
330  {
331    return resourceType;
332  }
333
334
335
336  /**
337   * Retrieves the current severity for the gauge, if available.
338   *
339   * @return  The current severity for the gauge, or {@code null} if it was not
340   *          included in the monitor entry.
341   */
342  public final AlarmSeverity getCurrentSeverity()
343  {
344    return currentSeverity;
345  }
346
347
348
349  /**
350   * Retrieves the previous severity for the gauge, if available.
351   *
352   * @return  The previous severity for the gauge, or {@code null} if it was not
353   *          included in the monitor entry.
354   */
355  public final AlarmSeverity getPreviousSeverity()
356  {
357    return previousSeverity;
358  }
359
360
361
362  /**
363   * Retrieves the summary message for the gauge, if available.
364   *
365   * @return  The summary message for the gauge, or {@code null} if it was not
366   *          included in the monitor entry.
367   */
368  public final String getSummary()
369  {
370    return summary;
371  }
372
373
374
375  /**
376   * Retrieves the error messages for the gauge, if available.
377   *
378   * @return  The list of error messages for the gauge, or an empty list if it
379   *          was not included in the monitor entry.
380   */
381  public final List<String> getErrorMessages()
382  {
383    return errorMessages;
384  }
385
386
387
388  /**
389   * Retrieves the time the gauge was initialized, if available.
390   *
391   * @return  The time the gauge was initialized, or {@code null} if it was not
392   *          included in the monitor entry.
393   */
394  public final Date getInitTime()
395  {
396    return initTime;
397  }
398
399
400
401  /**
402   * Retrieves the time the gauge was last updated, if available.
403   *
404   * @return  The time the gauge was last updated, or {@code null} if it was not
405   *          included in the monitor entry.
406   */
407  public final Date getUpdateTime()
408  {
409    return updateTime;
410  }
411
412
413
414  /**
415   * Retrieves the number of samples taken in the current interval, if
416   * available.
417   *
418   * @return  The number of samples taken in the current interval, or
419   *          {@code null} if it was not included in the monitor entry.
420   */
421  public final Long getSamplesThisInterval()
422  {
423    return samplesThisInterval;
424  }
425
426
427
428  /**
429   * Retrieves the time the gauge entered the current severity, if available.
430   *
431   * @return  The time the gauge entered the current severity, or {@code null}
432   *          if it was not included in the monitor entry.
433   */
434  public final Date getCurrentSeverityStartTime()
435  {
436    return currentSeverityStartTime;
437  }
438
439
440
441  /**
442   * Retrieves the current severity duration as a human-readable string, if
443   * available.
444   *
445   * @return  The current severity duration as a human-readable string, or
446   *          {@code null} if it was not included in the monitor entry.
447   */
448  public final String getCurrentSeverityDurationString()
449  {
450    return currentSeverityDurationString;
451  }
452
453
454
455  /**
456   * Retrieves the current severity duration in milliseconds, if available.
457   *
458   * @return  The current severity duration in milliseconds, or {@code null} if
459   *          it was not included in the monitor entry.
460   */
461  public final Long getCurrentSeverityDurationMillis()
462  {
463    return currentSeverityDurationMillis;
464  }
465
466
467
468  /**
469   * Retrieves the time the gauge last entered the normal state, if available.
470   *
471   * @return  The time the gauge last entered the normal state, or {@code null}
472   *          if it was not included in the monitor entry.
473   */
474  public final Date getLastNormalStateStartTime()
475  {
476    return lastNormalStateStartTime;
477  }
478
479
480
481  /**
482   * Retrieves the time the gauge last exited the normal state, if available.
483   *
484   * @return  The time the gauge last exited the normal state, or {@code null}
485   *          if it was not included in the monitor entry.
486   */
487  public final Date getLastNormalStateEndTime()
488  {
489    return lastNormalStateEndTime;
490  }
491
492
493
494  /**
495   * Retrieves the duration of the last normal state as a human-readable string,
496   * if available.
497   *
498   * @return  The duration of the last normal state as a human-readable string,
499   *          or {@code null} if it was not included in the monitor entry.
500   */
501  public final String getLastNormalStateDurationString()
502  {
503    return lastNormalStateDurationString;
504  }
505
506
507
508  /**
509   * Retrieves the duration of the last normal state in milliseconds, if
510   * available.
511   *
512   * @return  The duration of the last normal state in milliseconds, or
513   *          {@code null} if it was not included in the monitor entry.
514   */
515  public final Long getLastNormalStateDurationMillis()
516  {
517    return lastNormalStateDurationMillis;
518  }
519
520
521
522  /**
523   * Retrieves the total length of time the gauge has been in the normal state
524   * as a human-readable string, if available.
525   *
526   * @return  The total length of time the gauge has been in the normal state as
527   *          a human-readable string, or {@code null} if it was not included in
528   *          the monitor entry.
529   */
530  public final String getTotalNormalStateDurationString()
531  {
532    return totalNormalStateDurationString;
533  }
534
535
536
537  /**
538   * Retrieves the total length of time the gauge has been in the normal state
539   * in milliseconds, if available.
540   *
541   * @return  The total length of time the gauge has been in the normal state in
542   *          milliseconds, or {@code null} if it was not included in the
543   *          monitor entry.
544   */
545  public final Long getTotalNormalStateDurationMillis()
546  {
547    return totalNormalStateDurationMillis;
548  }
549
550
551
552  /**
553   * Retrieves the time the gauge last entered the warning state, if available.
554   *
555   * @return  The time the gauge last entered the warning state, or {@code null}
556   *          if it was not included in the monitor entry.
557   */
558  public final Date getLastWarningStateStartTime()
559  {
560    return lastWarningStateStartTime;
561  }
562
563
564
565  /**
566   * Retrieves the time the gauge last exited the warning state, if available.
567   *
568   * @return  The time the gauge last exited the warning state, or {@code null}
569   *          if it was not included in the monitor entry.
570   */
571  public final Date getLastWarningStateEndTime()
572  {
573    return lastWarningStateEndTime;
574  }
575
576
577
578  /**
579   * Retrieves the duration of the last warning state as a human-readable
580   * string, if available.
581   *
582   * @return  The duration of the last warning state as a human-readable string,
583   *          or {@code null} if it was not included in the monitor entry.
584   */
585  public final String getLastWarningStateDurationString()
586  {
587    return lastWarningStateDurationString;
588  }
589
590
591
592  /**
593   * Retrieves the duration of the last warning state in milliseconds, if
594   * available.
595   *
596   * @return  The duration of the last warning state in milliseconds, or
597   *          {@code null} if it was not included in the monitor entry.
598   */
599  public final Long getLastWarningStateDurationMillis()
600  {
601    return lastWarningStateDurationMillis;
602  }
603
604
605
606  /**
607   * Retrieves the total length of time the gauge has been in the warning state
608   * as a human-readable string, if available.
609   *
610   * @return  The total length of time the gauge has been in the warning state
611   *          as a human-readable string, or {@code null} if it was not included
612   *          in the monitor entry.
613   */
614  public final String getTotalWarningStateDurationString()
615  {
616    return totalWarningStateDurationString;
617  }
618
619
620
621  /**
622   * Retrieves the total length of time the gauge has been in the warning state
623   * in milliseconds, if available.
624   *
625   * @return  The total length of time the gauge has been in the warning state
626   *          in milliseconds, or {@code null} if it was not included in the
627   *          monitor entry.
628   */
629  public final Long getTotalWarningStateDurationMillis()
630  {
631    return totalWarningStateDurationMillis;
632  }
633
634
635
636  /**
637   * Retrieves the time the gauge last entered the minor state, if available.
638   *
639   * @return  The time the gauge last entered the minor state, or {@code null}
640   *          if it was not included in the monitor entry.
641   */
642  public final Date getLastMinorStateStartTime()
643  {
644    return lastMinorStateStartTime;
645  }
646
647
648
649  /**
650   * Retrieves the time the gauge last exited the minor state, if available.
651   *
652   * @return  The time the gauge last exited the minor state, or {@code null}
653   *          if it was not included in the monitor entry.
654   */
655  public final Date getLastMinorStateEndTime()
656  {
657    return lastMinorStateEndTime;
658  }
659
660
661
662  /**
663   * Retrieves the duration of the last minor state as a human-readable string,
664   * if available.
665   *
666   * @return  The duration of the last minor state as a human-readable string,
667   *          or {@code null} if it was not included in the monitor entry.
668   */
669  public final String getLastMinorStateDurationString()
670  {
671    return lastMinorStateDurationString;
672  }
673
674
675
676  /**
677   * Retrieves the duration of the last minor state in milliseconds, if
678   * available.
679   *
680   * @return  The duration of the last minor state in milliseconds, or
681   *          {@code null} if it was not included in the monitor entry.
682   */
683  public final Long getLastMinorStateDurationMillis()
684  {
685    return lastMinorStateDurationMillis;
686  }
687
688
689
690  /**
691   * Retrieves the total length of time the gauge has been in the minor state
692   * as a human-readable string, if available.
693   *
694   * @return  The total length of time the gauge has been in the minor state as
695   *          a human-readable string, or {@code null} if it was not included in
696   *          the monitor entry.
697   */
698  public final String getTotalMinorStateDurationString()
699  {
700    return totalMinorStateDurationString;
701  }
702
703
704
705  /**
706   * Retrieves the total length of time the gauge has been in the minor state
707   * in milliseconds, if available.
708   *
709   * @return  The total length of time the gauge has been in the minor state in
710   *          milliseconds, or {@code null} if it was not included in the
711   *          monitor entry.
712   */
713  public final Long getTotalMinorStateDurationMillis()
714  {
715    return totalMinorStateDurationMillis;
716  }
717
718
719
720  /**
721   * Retrieves the time the gauge last entered the major state, if available.
722   *
723   * @return  The time the gauge last entered the major state, or {@code null}
724   *          if it was not included in the monitor entry.
725   */
726  public final Date getLastMajorStateStartTime()
727  {
728    return lastMajorStateStartTime;
729  }
730
731
732
733  /**
734   * Retrieves the time the gauge last exited the major state, if available.
735   *
736   * @return  The time the gauge last exited the major state, or {@code null}
737   *          if it was not included in the monitor entry.
738   */
739  public final Date getLastMajorStateEndTime()
740  {
741    return lastMajorStateEndTime;
742  }
743
744
745
746  /**
747   * Retrieves the duration of the last major state as a human-readable string,
748   * if available.
749   *
750   * @return  The duration of the last major state as a human-readable string,
751   *          or {@code null} if it was not included in the monitor entry.
752   */
753  public final String getLastMajorStateDurationString()
754  {
755    return lastMajorStateDurationString;
756  }
757
758
759
760  /**
761   * Retrieves the duration of the last major state in milliseconds, if
762   * available.
763   *
764   * @return  The duration of the last major state in milliseconds, or
765   *          {@code null} if it was not included in the monitor entry.
766   */
767  public final Long getLastMajorStateDurationMillis()
768  {
769    return lastMajorStateDurationMillis;
770  }
771
772
773
774  /**
775   * Retrieves the total length of time the gauge has been in the major state
776   * as a human-readable string, if available.
777   *
778   * @return  The total length of time the gauge has been in the major state as
779   *          a human-readable string, or {@code null} if it was not included in
780   *          the monitor entry.
781   */
782  public final String getTotalMajorStateDurationString()
783  {
784    return totalMajorStateDurationString;
785  }
786
787
788
789  /**
790   * Retrieves the total length of time the gauge has been in the major state
791   * in milliseconds, if available.
792   *
793   * @return  The total length of time the gauge has been in the major state in
794   *          milliseconds, or {@code null} if it was not included in the
795   *          monitor entry.
796   */
797  public final Long getTotalMajorStateDurationMillis()
798  {
799    return totalMajorStateDurationMillis;
800  }
801
802
803
804  /**
805   * Retrieves the time the gauge last entered the critical state, if available.
806   *
807   * @return  The time the gauge last entered the critical state, or
808   *          {@code null} if it was not included in the monitor entry.
809   */
810  public final Date getLastCriticalStateStartTime()
811  {
812    return lastCriticalStateStartTime;
813  }
814
815
816
817  /**
818   * Retrieves the time the gauge last exited the critical state, if available.
819   *
820   * @return  The time the gauge last exited the critical state, or {@code null}
821   *          if it was not included in the monitor entry.
822   */
823  public final Date getLastCriticalStateEndTime()
824  {
825    return lastCriticalStateEndTime;
826  }
827
828
829
830  /**
831   * Retrieves the duration of the last critical state as a human-readable
832   * string, if available.
833   *
834   * @return  The duration of the last critical state as a human-readable
835   *          string, or {@code null} if it was not included in the monitor
836   *          entry.
837   */
838  public final String getLastCriticalStateDurationString()
839  {
840    return lastCriticalStateDurationString;
841  }
842
843
844
845  /**
846   * Retrieves the duration of the last critical state in milliseconds, if
847   * available.
848   *
849   * @return  The duration of the last critical state in milliseconds, or
850   *          {@code null} if it was not included in the monitor entry.
851   */
852  public final Long getLastCriticalStateDurationMillis()
853  {
854    return lastCriticalStateDurationMillis;
855  }
856
857
858
859  /**
860   * Retrieves the total length of time the gauge has been in the critical state
861   * as a human-readable string, if available.
862   *
863   * @return  The total length of time the gauge has been in the critical state
864   *          as a human-readable string, or {@code null} if it was not included
865   *          in the monitor entry.
866   */
867  public final String getTotalCriticalStateDurationString()
868  {
869    return totalCriticalStateDurationString;
870  }
871
872
873
874  /**
875   * Retrieves the total length of time the gauge has been in the critical state
876   * in milliseconds, if available.
877   *
878   * @return  The total length of time the gauge has been in the critical state
879   *          in milliseconds, or {@code null} if it was not included in the
880   *          monitor entry.
881   */
882  public final Long getTotalCriticalStateDurationMillis()
883  {
884    return totalCriticalStateDurationMillis;
885  }
886
887
888
889  /**
890   * {@inheritDoc}
891   */
892  @Override()
893  public String getMonitorDisplayName()
894  {
895    return INFO_GAUGE_MONITOR_DISPNAME.get();
896  }
897
898
899
900  /**
901   * {@inheritDoc}
902   */
903  @Override()
904  public String getMonitorDescription()
905  {
906    return INFO_GAUGE_MONITOR_DESC.get();
907  }
908
909
910
911  /**
912   * {@inheritDoc}
913   */
914  @Override()
915  public Map<String,MonitorAttribute> getMonitorAttributes()
916  {
917    final LinkedHashMap<String,MonitorAttribute> attrs =
918         new LinkedHashMap<String,MonitorAttribute>(43);
919
920    if (gaugeName != null)
921    {
922      addMonitorAttribute(attrs,
923           "gauge-name",
924           INFO_GAUGE_DISPNAME_GAUGE_NAME.get(),
925           INFO_GAUGE_DESC_GAUGE_NAME.get(),
926           gaugeName);
927    }
928
929    if (resource != null)
930    {
931      addMonitorAttribute(attrs,
932           "resource",
933           INFO_GAUGE_DISPNAME_RESOURCE.get(),
934           INFO_GAUGE_DESC_RESOURCE.get(),
935           resource);
936    }
937
938    if (resourceType != null)
939    {
940      addMonitorAttribute(attrs,
941           "resource-type",
942           INFO_GAUGE_DISPNAME_RESOURCE_TYPE.get(),
943           INFO_GAUGE_DESC_RESOURCE_TYPE.get(),
944           resourceType);
945    }
946
947    if (currentSeverity != null)
948    {
949      addMonitorAttribute(attrs,
950           "severity",
951           INFO_GAUGE_DISPNAME_CURRENT_SEVERITY.get(),
952           INFO_GAUGE_DESC_CURRENT_SEVERITY.get(),
953           currentSeverity.name());
954    }
955
956    if (previousSeverity != null)
957    {
958      addMonitorAttribute(attrs,
959           "previous-severity",
960           INFO_GAUGE_DISPNAME_PREVIOUS_SEVERITY.get(),
961           INFO_GAUGE_DESC_PREVIOUS_SEVERITY.get(),
962           previousSeverity.name());
963    }
964
965    if (summary != null)
966    {
967      addMonitorAttribute(attrs,
968           "summary",
969           INFO_GAUGE_DISPNAME_SUMMARY.get(),
970           INFO_GAUGE_DESC_SUMMARY.get(),
971           summary);
972    }
973
974    if (! errorMessages.isEmpty())
975    {
976      addMonitorAttribute(attrs,
977           "error-message",
978           INFO_GAUGE_DISPNAME_ERROR_MESSAGE.get(),
979           INFO_GAUGE_DESC_ERROR_MESSAGE.get(),
980           errorMessages);
981    }
982
983    if (initTime != null)
984    {
985      addMonitorAttribute(attrs,
986           "gauge-init-time",
987           INFO_GAUGE_DISPNAME_INIT_TIME.get(),
988           INFO_GAUGE_DESC_INIT_TIME.get(),
989           initTime);
990    }
991
992    if (updateTime != null)
993    {
994      addMonitorAttribute(attrs,
995           "update-time",
996           INFO_GAUGE_DISPNAME_UPDATE_TIME.get(),
997           INFO_GAUGE_DESC_UPDATE_TIME.get(),
998           updateTime);
999    }
1000
1001    if (samplesThisInterval != null)
1002    {
1003      addMonitorAttribute(attrs,
1004           "samples-this-interval",
1005           INFO_GAUGE_DISPNAME_SAMPLES_THIS_INTERVAL.get(),
1006           INFO_GAUGE_DESC_SAMPLES_THIS_INTERVAL.get(),
1007           samplesThisInterval);
1008    }
1009
1010    if (currentSeverityStartTime != null)
1011    {
1012      addMonitorAttribute(attrs,
1013           "current-severity-start-time",
1014           INFO_GAUGE_DISPNAME_CURRENT_START_TIME.get(),
1015           INFO_GAUGE_DESC_CURRENT_START_TIME.get(),
1016           currentSeverityStartTime);
1017    }
1018
1019    if (currentSeverityDurationString != null)
1020    {
1021      addMonitorAttribute(attrs,
1022           "current-severity-duration",
1023           INFO_GAUGE_DISPNAME_CURRENT_DURATION_STRING.get(),
1024           INFO_GAUGE_DESC_CURRENT_DURATION_STRING.get(),
1025           currentSeverityDurationString);
1026    }
1027
1028    if (currentSeverityDurationMillis != null)
1029    {
1030      addMonitorAttribute(attrs,
1031           "current-severity-duration-millis",
1032           INFO_GAUGE_DISPNAME_CURRENT_DURATION_MILLIS.get(),
1033           INFO_GAUGE_DESC_CURRENT_DURATION_MILLIS.get(),
1034           currentSeverityDurationMillis);
1035    }
1036
1037    if (lastNormalStateStartTime != null)
1038    {
1039      addMonitorAttribute(attrs,
1040           "last-normal-state-start-time",
1041           INFO_GAUGE_DISPNAME_LAST_NORMAL_START_TIME.get(),
1042           INFO_GAUGE_DESC_LAST_NORMAL_START_TIME.get(),
1043           lastNormalStateStartTime);
1044    }
1045
1046    if (lastNormalStateEndTime != null)
1047    {
1048      addMonitorAttribute(attrs,
1049           "last-normal-state-end-time",
1050           INFO_GAUGE_DISPNAME_LAST_NORMAL_END_TIME.get(),
1051           INFO_GAUGE_DESC_LAST_NORMAL_END_TIME.get(),
1052           lastNormalStateEndTime);
1053    }
1054
1055    if (lastNormalStateDurationString != null)
1056    {
1057      addMonitorAttribute(attrs,
1058           "last-normal-state-duration",
1059           INFO_GAUGE_DISPNAME_LAST_NORMAL_DURATION_STRING.get(),
1060           INFO_GAUGE_DESC_LAST_NORMAL_DURATION_STRING.get(),
1061           lastNormalStateDurationString);
1062    }
1063
1064    if (lastNormalStateDurationMillis != null)
1065    {
1066      addMonitorAttribute(attrs,
1067           "last-normal-state-duration-millis",
1068           INFO_GAUGE_DISPNAME_LAST_NORMAL_DURATION_MILLIS.get(),
1069           INFO_GAUGE_DESC_LAST_NORMAL_DURATION_MILLIS.get(),
1070           lastNormalStateDurationMillis);
1071    }
1072
1073    if (totalNormalStateDurationString != null)
1074    {
1075      addMonitorAttribute(attrs,
1076           "total-normal-state-duration",
1077           INFO_GAUGE_DISPNAME_TOTAL_NORMAL_DURATION_STRING.get(),
1078           INFO_GAUGE_DESC_TOTAL_NORMAL_DURATION_STRING.get(),
1079           totalNormalStateDurationString);
1080    }
1081
1082    if (totalNormalStateDurationMillis != null)
1083    {
1084      addMonitorAttribute(attrs,
1085           "total-normal-state-duration-millis",
1086           INFO_GAUGE_DISPNAME_TOTAL_NORMAL_DURATION_MILLIS.get(),
1087           INFO_GAUGE_DESC_TOTAL_NORMAL_DURATION_MILLIS.get(),
1088           totalNormalStateDurationMillis);
1089    }
1090
1091    if (lastWarningStateStartTime != null)
1092    {
1093      addMonitorAttribute(attrs,
1094           "last-warning-state-start-time",
1095           INFO_GAUGE_DISPNAME_LAST_WARNING_START_TIME.get(),
1096           INFO_GAUGE_DESC_LAST_WARNING_START_TIME.get(),
1097           lastWarningStateStartTime);
1098    }
1099
1100    if (lastWarningStateEndTime != null)
1101    {
1102      addMonitorAttribute(attrs,
1103           "last-warning-state-end-time",
1104           INFO_GAUGE_DISPNAME_LAST_WARNING_END_TIME.get(),
1105           INFO_GAUGE_DESC_LAST_WARNING_END_TIME.get(),
1106           lastWarningStateEndTime);
1107    }
1108
1109    if (lastWarningStateDurationString != null)
1110    {
1111      addMonitorAttribute(attrs,
1112           "last-warning-state-duration",
1113           INFO_GAUGE_DISPNAME_LAST_WARNING_DURATION_STRING.get(),
1114           INFO_GAUGE_DESC_LAST_WARNING_DURATION_STRING.get(),
1115           lastWarningStateDurationString);
1116    }
1117
1118    if (lastWarningStateDurationMillis != null)
1119    {
1120      addMonitorAttribute(attrs,
1121           "last-warning-state-duration-millis",
1122           INFO_GAUGE_DISPNAME_LAST_WARNING_DURATION_MILLIS.get(),
1123           INFO_GAUGE_DESC_LAST_WARNING_DURATION_MILLIS.get(),
1124           lastWarningStateDurationMillis);
1125    }
1126
1127    if (totalWarningStateDurationString != null)
1128    {
1129      addMonitorAttribute(attrs,
1130           "total-warning-state-duration",
1131           INFO_GAUGE_DISPNAME_TOTAL_WARNING_DURATION_STRING.get(),
1132           INFO_GAUGE_DESC_TOTAL_WARNING_DURATION_STRING.get(),
1133           totalWarningStateDurationString);
1134    }
1135
1136    if (totalWarningStateDurationMillis != null)
1137    {
1138      addMonitorAttribute(attrs,
1139           "total-warning-state-duration-millis",
1140           INFO_GAUGE_DISPNAME_TOTAL_WARNING_DURATION_MILLIS.get(),
1141           INFO_GAUGE_DESC_TOTAL_WARNING_DURATION_MILLIS.get(),
1142           totalWarningStateDurationMillis);
1143    }
1144
1145    if (lastMinorStateStartTime != null)
1146    {
1147      addMonitorAttribute(attrs,
1148           "last-minor-state-start-time",
1149           INFO_GAUGE_DISPNAME_LAST_MINOR_START_TIME.get(),
1150           INFO_GAUGE_DESC_LAST_MINOR_START_TIME.get(),
1151           lastMinorStateStartTime);
1152    }
1153
1154    if (lastMinorStateEndTime != null)
1155    {
1156      addMonitorAttribute(attrs,
1157           "last-minor-state-end-time",
1158           INFO_GAUGE_DISPNAME_LAST_MINOR_END_TIME.get(),
1159           INFO_GAUGE_DESC_LAST_MINOR_END_TIME.get(),
1160           lastMinorStateEndTime);
1161    }
1162
1163    if (lastMinorStateDurationString != null)
1164    {
1165      addMonitorAttribute(attrs,
1166           "last-minor-state-duration",
1167           INFO_GAUGE_DISPNAME_LAST_MINOR_DURATION_STRING.get(),
1168           INFO_GAUGE_DESC_LAST_MINOR_DURATION_STRING.get(),
1169           lastMinorStateDurationString);
1170    }
1171
1172    if (lastMinorStateDurationMillis != null)
1173    {
1174      addMonitorAttribute(attrs,
1175           "last-minor-state-duration-millis",
1176           INFO_GAUGE_DISPNAME_LAST_MINOR_DURATION_MILLIS.get(),
1177           INFO_GAUGE_DESC_LAST_MINOR_DURATION_MILLIS.get(),
1178           lastMinorStateDurationMillis);
1179    }
1180
1181    if (totalMinorStateDurationString != null)
1182    {
1183      addMonitorAttribute(attrs,
1184           "total-minor-state-duration",
1185           INFO_GAUGE_DISPNAME_TOTAL_MINOR_DURATION_STRING.get(),
1186           INFO_GAUGE_DESC_TOTAL_MINOR_DURATION_STRING.get(),
1187           totalMinorStateDurationString);
1188    }
1189
1190    if (totalMinorStateDurationMillis != null)
1191    {
1192      addMonitorAttribute(attrs,
1193           "total-minor-state-duration-millis",
1194           INFO_GAUGE_DISPNAME_TOTAL_MINOR_DURATION_MILLIS.get(),
1195           INFO_GAUGE_DESC_TOTAL_MINOR_DURATION_MILLIS.get(),
1196           totalMinorStateDurationMillis);
1197    }
1198
1199    if (lastMajorStateStartTime != null)
1200    {
1201      addMonitorAttribute(attrs,
1202           "last-major-state-start-time",
1203           INFO_GAUGE_DISPNAME_LAST_MAJOR_START_TIME.get(),
1204           INFO_GAUGE_DESC_LAST_MAJOR_START_TIME.get(),
1205           lastMajorStateStartTime);
1206    }
1207
1208    if (lastMajorStateEndTime != null)
1209    {
1210      addMonitorAttribute(attrs,
1211           "last-major-state-end-time",
1212           INFO_GAUGE_DISPNAME_LAST_MAJOR_END_TIME.get(),
1213           INFO_GAUGE_DESC_LAST_MAJOR_END_TIME.get(),
1214           lastMajorStateEndTime);
1215    }
1216
1217    if (lastMajorStateDurationString != null)
1218    {
1219      addMonitorAttribute(attrs,
1220           "last-major-state-duration",
1221           INFO_GAUGE_DISPNAME_LAST_MAJOR_DURATION_STRING.get(),
1222           INFO_GAUGE_DESC_LAST_MAJOR_DURATION_STRING.get(),
1223           lastMajorStateDurationString);
1224    }
1225
1226    if (lastMajorStateDurationMillis != null)
1227    {
1228      addMonitorAttribute(attrs,
1229           "last-major-state-duration-millis",
1230           INFO_GAUGE_DISPNAME_LAST_MAJOR_DURATION_MILLIS.get(),
1231           INFO_GAUGE_DESC_LAST_MAJOR_DURATION_MILLIS.get(),
1232           lastMajorStateDurationMillis);
1233    }
1234
1235    if (totalMajorStateDurationString != null)
1236    {
1237      addMonitorAttribute(attrs,
1238           "total-major-state-duration",
1239           INFO_GAUGE_DISPNAME_TOTAL_MAJOR_DURATION_STRING.get(),
1240           INFO_GAUGE_DESC_TOTAL_MAJOR_DURATION_STRING.get(),
1241           totalMajorStateDurationString);
1242    }
1243
1244    if (totalMajorStateDurationMillis != null)
1245    {
1246      addMonitorAttribute(attrs,
1247           "total-major-state-duration-millis",
1248           INFO_GAUGE_DISPNAME_TOTAL_MAJOR_DURATION_MILLIS.get(),
1249           INFO_GAUGE_DESC_TOTAL_MAJOR_DURATION_MILLIS.get(),
1250           totalMajorStateDurationMillis);
1251    }
1252
1253    if (lastCriticalStateStartTime != null)
1254    {
1255      addMonitorAttribute(attrs,
1256           "last-critical-state-start-time",
1257           INFO_GAUGE_DISPNAME_LAST_CRITICAL_START_TIME.get(),
1258           INFO_GAUGE_DESC_LAST_CRITICAL_START_TIME.get(),
1259           lastCriticalStateStartTime);
1260    }
1261
1262    if (lastCriticalStateEndTime != null)
1263    {
1264      addMonitorAttribute(attrs,
1265           "last-critical-state-end-time",
1266           INFO_GAUGE_DISPNAME_LAST_CRITICAL_END_TIME.get(),
1267           INFO_GAUGE_DESC_LAST_CRITICAL_END_TIME.get(),
1268           lastCriticalStateEndTime);
1269    }
1270
1271    if (lastCriticalStateDurationString != null)
1272    {
1273      addMonitorAttribute(attrs,
1274           "last-critical-state-duration",
1275           INFO_GAUGE_DISPNAME_LAST_CRITICAL_DURATION_STRING.get(),
1276           INFO_GAUGE_DESC_LAST_CRITICAL_DURATION_STRING.get(),
1277           lastCriticalStateDurationString);
1278    }
1279
1280    if (lastCriticalStateDurationMillis != null)
1281    {
1282      addMonitorAttribute(attrs,
1283           "last-critical-state-duration-millis",
1284           INFO_GAUGE_DISPNAME_LAST_CRITICAL_DURATION_MILLIS.get(),
1285           INFO_GAUGE_DESC_LAST_CRITICAL_DURATION_MILLIS.get(),
1286           lastCriticalStateDurationMillis);
1287    }
1288
1289    if (totalCriticalStateDurationString != null)
1290    {
1291      addMonitorAttribute(attrs,
1292           "total-critical-state-duration",
1293           INFO_GAUGE_DISPNAME_TOTAL_CRITICAL_DURATION_STRING.get(),
1294           INFO_GAUGE_DESC_TOTAL_CRITICAL_DURATION_STRING.get(),
1295           totalCriticalStateDurationString);
1296    }
1297
1298    if (totalCriticalStateDurationMillis != null)
1299    {
1300      addMonitorAttribute(attrs,
1301           "total-critical-state-duration-millis",
1302           INFO_GAUGE_DISPNAME_TOTAL_CRITICAL_DURATION_MILLIS.get(),
1303           INFO_GAUGE_DESC_TOTAL_CRITICAL_DURATION_MILLIS.get(),
1304           totalCriticalStateDurationMillis);
1305    }
1306
1307    return Collections.unmodifiableMap(attrs);
1308  }
1309}