Timezone mismatch across cluster members-juniper-junos

Timezone mismatch across cluster members-juniper-junos
0

Timezone mismatch across cluster members-juniper-junos

Vendor: juniper

OS: junos

Description:
Indeni will identify when two devices are part of a cluster and alert if the timezone setting is different.

Remediation Steps:
Review the settings of each device in the cluster and ensure they are the same.

How does this work?
This script logs into the Juniper JUNOS-based device using SSH and retrieves the configured time zone using the output of the “show system uptime” command. The output includes the device’s current date and time as well as configured time zone.

Why is this important?
Capture the current time zone of the device. The time zone information is useful for display purposes.

Without Indeni how would you find this?
An administrator may write a script to pull this data from cluster members and compare it.

junos-show-system-uptime-cluster

name: junos-show-system-uptime-cluster
description: Retrieve system uptime, timezone and current date and time
type: monitoring
monitoring_interval: 5 minute
requires:
    vendor: juniper
    os.name: junos
    high-availability: true
comments:
    uptime-seconds:
        why: "Capture the uptime of the device. If the uptime is lower than the previous\
            \ sample, the device must have reloaded. \n"
        how: |
            This script logs into the Juniper JUNOS-based device using SSH and retrieves the output of the "show system uptime" command. The output includes the device's uptime as well as additional information.
        without-indeni: |
            It is possible to poll this data through SNMP or capture a syslog/trap event of a device booting up.
        can-with-snmp: true
        can-with-syslog: true
    current-datetime:
        why: "Capture the current date and time of the device. Device current date\
            \ and time should never be more than 24 hours away from date and time\
            \ of the device polling the data, otherwise date and time are not correctly\
            \ set on device. \n"
        how: |
            This script logs into the Juniper JUNOS-based device using SSH and retrieves the current time using the output of the "show system uptime" command. The output includes the device's current date and time as well as configured time zone.
        without-indeni: |
            It is possible to poll this data through SNMP.
        can-with-snmp: true
        can-with-syslog: false
    timezone:
        why: "Capture the current time zone of the device. The time zone information\
            \ is useful for display purposes. \n"
        how: |
            This script logs into the Juniper JUNOS-based device using SSH and retrieves the configured time zone using the output of the "show system uptime" command. The output includes the device's current date and time as well as configured time zone.
        without-indeni: |
            An administrator may write a script to pull this data from cluster members and compare it.
        can-with-snmp: false
        can-with-syslog: false
steps:
-   run:
        type: SSH
        command: show chassis hardware node local | display xml
    parse:
        type: XML
        file: show-system-uptime-cluster.parser.1.xml.yaml
-   run:
        type: SSH
        command: show system uptime node ${node} | display xml
    parse:
        type: XML
        file: show-system-uptime-cluster.parser.2.xml.yaml

cross_vendor_compare_timezone

// Deprecation warning : Scala template-based rules are deprecated. Please use YAML format rules instead.

package com.indeni.server.rules.library.templatebased.crossvendor

import com.indeni.server.rules.RuleContext
import com.indeni.server.rules.library.templates.SnapshotComparisonTemplateRule
import com.indeni.server.rules.RemediationStepCondition

/**
  *
  */
case class cross_vendor_compare_timezone() extends SnapshotComparisonTemplateRule(
  ruleName = "cross_vendor_compare_timezone",
  ruleFriendlyName = "Clustered Devices: Timezone mismatch across cluster members",
  ruleDescription = "Indeni will identify when two devices are part of a cluster and alert if the timezone setting is different.",
  metricName = "timezone",
  isArray = false,
  alertDescription = "The members of a cluster of devices must have the same timezone settings.",
  baseRemediationText = """Review the settings of each device in the cluster and ensure they are the same.""")(
  RemediationStepCondition.VENDOR_CISCO ->
    """|
      |1. Execute the show clock command to check the system time for both peer switches
      |2. Review the time-zone setting of each device in the cluster and ensure they are the same.
      |3. For more information about  NX-OS timezone configuration review the next link:
      |https://www.cisco.com/c/en/us/td/docs/switches/datacenter/sw/4_0/nx-os/fundamentals/configuration/guide2/fun_nx-os_book/fun_5sys_mgmt.html""".stripMargin
)