Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up

Nagios World Conference 2026: Sept. 14-17 in St. Paul, MN | Learn More

  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4401Themes and Skins13Add-ons756Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Clustering and High-Availability check_proc_fd.sh: check process memory usage
0.0 (0)
10.6K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Yoann LAMY (7)Julien DESMAREST (4)deskwork_itunes142 (4)Sam N (3)Davide Lemma (3)
See More
Newest Contributors
signalgrid (1)Sanna Glue (2)fisherrs (1)smolinux (1)juanfertor (1)
See More

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > Jeremy
J

Jeremy

@jlevy

User Stats

Member Since: August 10, 2018

Favorites0

Views

Projects0

No Projects Found
check_virsh

Hi I did some changes. Now script check the entire name!!!

#!/bin/bash # Versao 1.2 # Criador: Aline Carvalho # Criacao: 14/10/2009 # LastCHanges: 10/08/2018 # By Jeremy Levy # |_ English Tradution. Corrige no exact name # # Objective: Verify that virtual server is online or offline ## Variables VIRSH=`which virsh` function check_srv { HOST=$1 # Check if sudo command is installed which sudo > /dev/null 2>&1 if [ $? -ne 0 ] then echo "ERRO: sudo not installing" exit 3 fi #sudo $VIRSH list | grep $HOST > /dev/null RESULT=`sudo $VIRSH list | grep $HOST | cut -d" " -f7` for FOO in $RESULT do #if [ $? != "0" ] if [ "$FOO" != "$HOST" ] then echo "CRITICAL: Virtual Machine $HOST is down, or not exist!!!" exit 2 else STATE=`sudo $VIRSH list | grep $HOST | awk '{ print $3 }'` if [ $STATE == "paused" ] then echo "WARNING: $HOST is in paused states." exit 1 elif [ $STATE == "blocked" ] then echo "WARNING: $HOST is in blocked states." exit 1 elif [ $STATE == "shutdown" ] then echo "WARNING: $HOST is in shutdown states." exit 1 elif [ $STATE == "crashed" ] then echo "WARNING: $HOST is in crashed states." exit 1 elif [ $STATE == "dying" ] then echo "WARNING: $HOST is in dying states." exit 1 else echo "OK: Virtual Machine $HOST is UP" exit 0 fi fi done } function print_usage { echo "" echo "" echo " Usage: $0 srv HOST " echo "" echo " Important: " echo " First of all you need to configure sudo in /etc/sudores:" echo " nagios ALL=(ALL) NOPASSWD:/usr/bin/virsh list" echo " and comment the line # Defaults requiretty" echo "" } ## Checks if the user has typed the command with the correct parameters case $1 in srv) HOST=$2 if [ -z $2 ] then echo "" echo "You need to specify the virtual machine" echo " ex: $0 $1 HOST" echo "" exit 3 fi check_srv $HOST ;; *) print_usage ;; esac

Reviewed 8 years ago

No Favorites Found

Copyright © 2009-2026 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile