5

Apigee Cassandra log script

This script is designed to interact with Cassandra instances running within a Apigee Hybrid Kubernetes cluster. It utilizes nodetool, a command-line utility for managing a Cassandra cluster, to execute a series of diagnostic commands on all Cassandra pods matching a specific label within a given namespace.

Features

  • Namespace and App Label Customization: Easily specify the Kubernetes namespace and the application label to target specific Cassandra pods.
  • Secure Credential Handling: Fetches Cassandra user and password credentials securely from a Kubernetes secret.
  • Comprehensive Diagnostics: Executes a wide array of nodetool commands to gather detailed diagnostics from each targeted Cassandra pod.
  • Automated Output Management: Saves the output of each nodetool command to a timestamped file for easy review and analysis.

Usage

  1. Set Namespace and App Label: Modify the NAMESPACE and APP_LABEL variables at the top of the script to match your deployment if needed, for Apigee Hybrid default installations, you can skip this step.

  2. Ensure Correct Permissions: Make sure the script has execute permissions:

    chmod +x script.sh
  3. Run the Script: Execute the script from your terminal:

    ./script.sh

Output

The script generates output files in the /tmp directory for each nodetool command executed. Files are named in the format k_nodetool_<command>_<pod_name>_<timestamp>.txt, making it easy to identify and correlate outputs.