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