Git Product home page Git Product logo

openshift-checks's Introduction

openshift-checks

A set of scripts to run basic checks on an OpenShift cluster. PRs welcome!

โš ๏ธ This is an unofficial tool, don't blame us if it breaks your cluster

Usage

$ ./openshift-checks.sh -h
Usage: openshift-checks.sh [-h]

This script will run a minimum set of checks to an OpenShift cluster

Available options:

-h, --help                        Print this help and exit
-v, --verbose                     Print script debug info
-l, --list                        Lists the available checks
-s <script>, --single <script>    Executes only the provided script
--no-info                         Disable cluster info commands (default: enabled)
--no-checks                       Disable cluster check commands (default: enabled)

With no options, it will run all checks and info commands with no debug info

Container

You can build your own container with all the scripts with the included Containerfile

$ podman build --tag foobar/openshiftchecks .
STEP 1: FROM registry.redhat.io/ubi8/ubi:latest
...

Then, run it with a proper kubeconfig attached and use any flag you need:

$ podman run -it --rm -v /home/foobar/kubeconfig:/kubeconfig:Z -e KUBECONFIG=/kubeconfig foobar/openshiftchecks:latest -h
Usage: openshift-checks.sh [-h]
...

You can even create a handy alias:

$ alias openshift-checks="podman run -it --rm -v /home/foobar/kubeconfig:/kubeconfig:Z -e KUBECONFIG=/kubeconfig foobar/openshiftchecks:latest"
$ openshift-checks -s info/00-clusterversion
Using default/api-foobar-example-com:6443/system:admin context
...

CronJob

The checks can be scheduled to run periodically in an OpenShift cluster by creating a CronJob.

Check the cronjob.yaml example.

How it works

The openshift-checks.sh script is just a wrapper around bash scripts located in the info or checks folders.

Checks

Script Description
alertmanager Checks if there are warning or error alerts firing
chronyc Checks if the worker clocks are synced using chronyc
clusterversion_errors Checks if there are clusterversion errors
csr Checks if there are pending csr
entropy Checks if the workers have enough entropy
iptables-22623-22624 Checks if the nodes iptables rules are blocking 22623/tpc or 22624/tcp
mcp Checks if there are degraded mcp
nodes Checks if there are not ready or not schedulable nodes
notrunningpods Checks if there are not running pods
operators Checks if there are operators in 'bad' state
restarts Checks if there are pods restarted > n times (10 by default)
terminating Checks if there are pods terminating

Info

Script Description
clusterversion Show the clusterversion
clusteroperators Show the clusteroperators
nodes Show the nodes status
pods Show the pods running in the cluster
biosversion Show the nodes' BIOS version
ethtool-firmware-version Show the nodes' NIC firmware version using ethtool
mellanox-firmware-version Show the nodes' Mellanox Connect-4 firmware version
intel-firmware-version Reports firmware versions of supported Intel cards if any are found
mtu Show the nodes' MTU for some interfaces
ovs-hostnames Show the ovs database chassis hostnames

Environment variables

Environment variable Default value Description
OCDEBUGIMAGE registry.redhat.io/rhel8/support-tools:latest Used by oc debug.
OSETOOLSIMAGE registry.redhat.io/openshift4/ose-tools-rhel8:latest Used by oc debug in ethtool-firmware-version
RESTART_THRESHOLD 10 Used by the restarts script.
INTEL_IDS 8086:158b Intel device IDs to check for firmware. Can be overridden for non-supported NICs.

About firmware version

The current intel-firmware-version and mellanox-firmware-version checks only check the firmware version of the SRIOV operator supported NICs (in 4.6).

You can add your own device ID if needed by modifying the script (hint, the variable is called IDS and the format is vendorID_A:deviceID_A vendorID_B:deviceID_B)

Collaborate

Add a new script to get some information or to perform some check in the proper folder and create a pull request.

Tips & Tricks

Send an email if some check fails

You can pipe the script to mail and if there are any errors, an email will be sent.

First you can configure postfix (already included in RHEL8) as relay host (see https://access.redhat.com/solutions/217503). As an example:

  • Append the following settings in /etc/postfix/main.cf:
myhostname = kni1-bootstrap.example.com
relayhost = smtp.example.com
  • Restart the postfix service:
sudo systemctl restart postfix
  • Test it:
echo "Hola" | mail -s 'Subject' [email protected]

Then, run the script as:

/openshift-checks.sh > /tmp/oc-errors 2>&1 || mail -s "Something has failed" [email protected] < /tmp/oc-errors

As a bonus you can include this in a cronjob for periodic checks.

openshift-checks's People

Contributors

dcritch avatar e-minguez avatar sronanrh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.