Skip to content

striker script for services check on cluster #913

@amanjot01

Description

@amanjot01

striker-check-service
this can be used in order to test different services and can be further modified to even check more services either on striker and node.

#!/bin/bash

Color definitions

GREEN="\e[32m"
YELLOW="\e[33m"
RED="\e[31m"
RESET="\e[0m"

echo -e "${YELLOW}Checking striker-ui-api service on local machine...${RESET}"

Check local striker-ui-api

if systemctl is-active --quiet striker-ui-api; then
echo -e "${GREEN}✅ striker-ui-api is running locally.${RESET}"
else
echo -e "${RED}❌ striker-ui-api is NOT running locally.${RESET}"
fi

echo "=================================================="
read -p "Enter hostname or IP of customer node: " NODE

echo -e "\nConnecting to ${NODE}..."
echo "=================================================="

Check if the remote node is reachable

if ! ping -c 1 -W 2 "$NODE" &>/dev/null; then
echo -e "${RED}❌ Unable to reach ${NODE}. Please check if the system is powered on or if there is a network issue.${RESET}"
exit 1
fi

Remote PCS status

echo -e "\n${YELLOW}=== PCS Cluster Status ===${RESET}"
ssh -tt root@"$NODE" '
if command -v pcs >/dev/null; then
TERM=xterm pcs status
else
echo "pcs command not found"
fi
' 2>/dev/null

Remote disk usage

echo -e "\n${YELLOW}=== Disk Usage (df -h) ===${RESET}"
ssh root@"$NODE" 'df -h --output=source,size,used,avail,pcent,target' 2>/dev/null

Anvil daemon statuses (simplified output)

echo -e "\n${YELLOW}=== Status of important services at host ${NODE} ===${RESET}"
ssh root@"$NODE" '
for service in anvil-daemon scancore anvil-safe-start; do
if systemctl is-active --quiet "$service"; then
echo -e "\e[32m✅ $service is running\e[0m"
else
echo -e "\e[31m❌ $service is NOT running\e[0m"
fi
done
' 2>/dev/null

Virtual machine status

echo -e "\n${YELLOW}=== Virtual Machines (virsh list --all) ===${RESET}"
ssh root@"$NODE" '
if command -v virsh >/dev/null; then
virsh list --all
else
echo "virsh command not found"
fi
' 2>/dev/null

Striker-check-service.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions