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