diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index a462a2a495..833063c2ae 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,14 @@ +2008-12-11 Evi Vanoost + + * linux/plugins/SGE: Added the SGE plugin + + * mac_osx/plugins/SGE: Renamed the SGE plugin to be consistent with Linux + + * mac_osx/pandora_agent, mac_osx/pandora_agent.conf, + mac_osx/pandora_agent_installer, mac_osx/pandora_fms/StartupParameters.list + mac_osx/pandora_fms/pandora_fms: Updated to latest (2.0) client code. Fixed + installer issues where it would overwrite previous config. + 2008-12-11 Ramon Novoa * win32/pandora_windows_service.h, diff --git a/pandora_agents/linux/plugins/README b/pandora_agents/linux/plugins/README new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pandora_agents/linux/plugins/SGEStatus.sh b/pandora_agents/linux/plugins/SGEStatus.sh new file mode 100755 index 0000000000..9d76a89a13 --- /dev/null +++ b/pandora_agents/linux/plugins/SGEStatus.sh @@ -0,0 +1,89 @@ +#!/bin/bash +############################################################################### +# +# Copyright (c) 2008 Evi Vanoost +# +# SGEStatus: A quick shell script that can be used as a Pandora plugin to +# display the SGE cluster status +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +############################################################################### + + +SGE_BIN="/RCBI/sge/bin/darwin-ppc" + +PENDING=$[`$SGE_BIN/qstat -s p | grep " qw " | wc -l`+0] +RUNNING=$[`$SGE_BIN/qstat -s a | grep " r " | wc -l`+0] +HOSTS=$[`qhost | wc -l`-3] +QUEUES=`qstat -g c | grep -v '\-\-\-' | grep -v "CLUSTER QUEUE" | awk '{print $1}'` +NUMQUEUE=0 + +echo " + Pending Jobs (Cluster) + $PENDING + generic_data + + Running Jobs (Cluster) + $RUNNING + generic_data + + Number of Hosts (Cluster) + $HOSTS + generic_data" + +for queue in $QUEUES +do + NUMQUEUE=$[$NUMQUEUE+1] + # CLUSTER QUEUE CQLOAD USED AVAIL TOTAL aoACDS cdsuE + # 64bit 0.15 0 8 22 0 14 + QINFO=`qstat -g c | grep $queue` + AVGLOAD=`echo $QINFO | awk '{print $2}'` + USEDSLOTS=`echo $QINFO | awk '{print $3}'` + AVAILSLOTS=`echo $QINFO | awk '{print $4}'` + TOTALSLOTS=`echo $QINFO | awk '{print $5}'` + ADMSTATUS=`echo $QINFO | awk '{print $6}'` + ERRSTATUS=`echo $QINFO | awk '{print $7}'` + echo " + Available Slots (Q: $queue) + $AVAILSLOTS + generic_data + + + Used Slots (Q: $queue) + $USEDSLOTS + generic_data + + + Total Slots (Q: $queue) + $TOTALSLOTS + generic_data + + + Average load (Q: $queue) + $AVGLOAD + generic_data + + + Slots in Status aoACDS (Q: $queue) + $ADMSTATUS + generic_data + + + Slots in Status cdsuE (Q: $queue) + $ERRSTATUS + generic_data + " +done + +echo " + Number of Queues + $NUMQUEUE + generic_data" diff --git a/pandora_agents/mac_osx/pandora_agent b/pandora_agents/mac_osx/pandora_agent index 9039174d89..7c850bf86f 100755 --- a/pandora_agents/mac_osx/pandora_agent +++ b/pandora_agents/mac_osx/pandora_agent @@ -1,14 +1,14 @@ #!/bin/bash # ********************************************************************** # Pandora FMS Generic Host Agent -# GNU/Linux version 2.0 +# Mac OS X/Linux version 2.0 # (c) 2003-2008 Sancho Lerena # with the help of many people. Please see http://pandora.sourceforge.net # This code is licensed under GPL 2.0 license. # ********************************************************************** AGENT_VERSION=2.0 -AGENT_BUILD=080619 +AGENT_BUILD=081211 # ********************************************************************** # function configure_agent() @@ -17,7 +17,7 @@ AGENT_BUILD=080619 function configure_agent { # Read config file - for a in `cat $PANDORA_HOME/pandora_agent.conf | grep -v -e "^#" | grep -v -e "^module"` + for a in `cat $PANDORA_HOME/pandora_agent.conf | grep -v -e "^#" | grep -v -e "^module" ` do a=`echo $a | tr -s " " " "` # Get general configuration parameters from config file @@ -25,68 +25,55 @@ function configure_agent { then PANDORA_LOGFILE=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Pandora Logfile is $PANDORA_LOGFILE" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^server_ip'`" ] + elif [ ! -z "`echo $a | grep -e '^server_ip'`" ] then SERVER_IP=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Server IP Address is $SERVER_IP" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^server_path'`" ] + elif [ ! -z "`echo $a | grep -e '^server_path'`" ] then SERVER_PATH=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Server Path is $SERVER_PATH" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^temporal'`" ] + elif [ ! -z "`echo $a | grep -e '^temporal'`" ] then TEMP=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Temporal Path is $TEMP" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^interval'`" ] + elif [ ! -z "`echo $a | grep -e '^interval'`" ] then INTERVAL=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Interval is $INTERVAL seconds" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^agent_name'`" ] + elif [ ! -z "`echo $a | grep -e '^agent_name'`" ] then NOMBRE_HOST=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Agent name is $NOMBRE_HOST " >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^debug'`" ] + elif [ ! -z "`echo $a | grep -e '^debug'`" ] then DEBUG_MODE=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Debug mode is $DEBUG_MODE " >> $PANDORA_LOGFILE - fi - # Contribution of daggett - if [ ! -z "`echo $a | grep -e '^server_port'`" ] + elif [ ! -z "`echo $a | grep -e '^server_port'`" ] then SERVER_PORT=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Server Port is $SERVER_PORT" >> $PANDORA_LOGFILE - fi # Contribution of daggett - if [ ! -z "`echo $a | grep -e '^encoding'`" ] + elif [ ! -z "`echo $a | grep -e '^encoding'`" ] then ENCODING=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Encoding is $ENCODING" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^transfer_mode'`" ] + elif [ ! -z "`echo $a | grep -e '^transfer_mode'`" ] then TRANSFER_MODE=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - Transfer Mode is $TRANSFER_MODE" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^delayed_startup'`" ] + elif [ ! -z "`echo $a | grep -e '^delayed_startup'`" ] then DELAYED_STARTUP=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - DELAYED_STARTUP is $DELAYED_STARTUP" >> $PANDORA_LOGFILE - fi # CPU protection - if [ ! -z "`echo $a | grep -e '^pandora_nice'`" ] + elif [ ! -z "`echo $a | grep -e '^pandora_nice'`" ] then PANDORA_NICE=`echo $a | awk '{ print $2 }' ` echo "$TIMESTAMP - [SETUP] - PandoraFMS Nice is $PANDORA_NICE" >> $PANDORA_LOGFILE - fi # Tentacle options - if [ ! -z "`echo $a | grep -e '^server_pwd'`" ] + elif [ ! -z "`echo $a | grep -e '^server_pwd'`" ] then SERVER_PWD=`echo $a | awk '{ print $2 }' ` if [ ! -z "$SERVER_PWD" ] @@ -94,8 +81,7 @@ function configure_agent { TENTACLE_OPTS="-x $SERVER_PWD $TENTACLE_OPTS" echo "$TIMESTAMP - [SETUP] - Server password set (FTP/Tentacle)" >> $PANDORA_LOGFILE fi - fi - if [ ! -z "`echo $a | grep -e '^server_ssl'`" ] + elif [ ! -z "`echo $a | grep -e '^server_ssl'`" ] then SERVER_SSL=`echo $a | awk '{ print $2 }' ` if [ "$SERVER_SSL" == "yes" ] @@ -103,13 +89,11 @@ function configure_agent { TENTACLE_OPTS="-c $TENTACLE_OPTS" echo "$TIMESTAMP - [SETUP] - OpenSSL enabled for Tentacle" >> $PANDORA_LOGFILE fi - fi - if [ ! -z "`echo $a | grep -e '^cron_mode'`" ] - then + elif [ ! -z "`echo $a | grep -e '^cron_mode'`" ] + then CRON_MODE=1 - echo "$TIMESTAMP - [SETUP] - Cronmode enabled" >> $PANDORA_LOGFILE - fi - if [ ! -z "`echo $a | grep -e '^server_opts'`" ] + echo "$TIMESTAMP - [SETUP] - Scheduled mode enabled" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^server_opts'`" ] then SERVER_OPTS=`echo $a | cut -d" " -f2-` if [ ! -z "$SERVER_OPTS" ] @@ -117,15 +101,59 @@ function configure_agent { TENTACLE_OPTS="$SERVER_OPTS $TENTACLE_OPTS" echo "$TIMESTAMP - [SETUP] - Extra options for the Tentacle client $SERVER_OPTS" >> $PANDORA_LOGFILE fi - fi # Remote configuration - if [ ! -z "`echo $a | grep -e '^remote_config'`" ] + elif [ ! -z "`echo $a | grep -e '^remote_config'`" ] then REMOTE_CONFIG=`echo $a | awk '{ print $2 }'` if [ "$REMOTE_CONFIG" == "1" ] then echo "$TIMESTAMP - [SETUP] - Remote configuration enabled" >> $PANDORA_LOGFILE fi + # Secondary server configuration + elif [ ! -z "`echo $a | grep -e '^secondary_mode'`" ] + then + SECONDARY_MODE=`echo $a | awk '{ print $2 }' ` + echo "$TIMESTAMP - [SETUP] - Secondary server mode is '$SECONDARY_MODE'" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^secondary_transfer_mode'`" ] + then + SECONDARY_TRANSFER_MODE=`echo $a | awk '{ print $2 }' ` + echo "$TIMESTAMP - [SETUP] - Secondary transfer Mode is $SECONDARY_TRANSFER_MODE" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^secondary_server_ip'`" ] + then + SECONDARY_SERVER_IP=`echo $a | awk '{ print $2 }' ` + echo "$TIMESTAMP - [SETUP] - Secondary server IP Address is $SECONDARY_SERVER_IP" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^secondary_server_path'`" ] + then + SECONDARY_SERVER_PATH=`echo $a | awk '{ print $2 }' ` + echo "$TIMESTAMP - [SETUP] - Secondary server Path is $SECONDARY_SERVER_PATH" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^secondary_server_port'`" ] + then + SECONDARY_SERVER_PORT=`echo $a | awk '{ print $2 }' ` + echo "$TIMESTAMP - [SETUP] - Secondary server Port is $SECONDARY_SERVER_PORT" >> $PANDORA_LOGFILE + elif [ ! -z "`echo $a | grep -e '^secondary_server_pwd'`" ] + then + SECONDARY_SERVER_PWD=`echo $a | awk '{ print $2 }' ` + if [ ! -z "$SECONDARY_SERVER_PWD" ] + then + SECONDARY_TENTACLE_OPTS="-x $SECONDARY_SERVER_PWD $SECONDARY_TENTACLE_OPTS" + echo "$TIMESTAMP - [SETUP] - Secondary server password set (FTP/Tentacle)" >> $PANDORA_LOGFILE + fi + elif [ ! -z "`echo $a | grep -e '^secondary_server_ssl'`" ] + then + SECONDARY_SERVER_SSL=`echo $a | awk '{ print $2 }' ` + if [ "$SECONDARY_SERVER_SSL" == "yes" ] + then + SECONDARY_TENTACLE_OPTS="-c $SECONDARY_TENTACLE_OPTS" + echo "$TIMESTAMP - [SETUP] - OpenSSL enabled for secondary Tentacle" >> $PANDORA_LOGFILE + fi + elif [ ! -z "`echo $a | grep -e '^secondary_server_opts'`" ] + then + SECONDARY_SERVER_OPTS=`echo $a | cut -d" " -f2-` + if [ ! -z "$SERVER_OPTS" ] + then + SECONDARY_TENTACLE_OPTS="$SECONDARY_SERVER_OPTS $SECONDARY_TENTACLE_OPTS" + echo "$TIMESTAMP - [SETUP] - Extra options for the secondary Tentacle client $SECONDARY_SERVER_OPTS" >> $PANDORA_LOGFILE + fi fi done @@ -137,13 +165,16 @@ function configure_agent { echo "Running in $NOMBRE_HOST at $TIMESTAMP" echo " " else - # Checks if there is another instance running - PID_RUNNING=`pidof -x pandora_agent` + # Checks if there is another instance running in cron mode + # there is no pidof in Mac OS X. We use good ol' pid files + PID_RUNNING=`cat /tmp/pandora_agent_cron.pid 2> /dev/null || echo 0` PID_ME=$$ if [ "$PID_ME" != "$PID_RUNNING" ] then echo "Aborting execution. Another instance of Pandora FMS running" exit + else + echo $PID_ME > /tmp/pandora_agent_cron.pid fi fi @@ -210,6 +241,34 @@ FEOF1 return 1 } +# ********************************************************************** +# function send_file_secure(file) +# Sends the file to the available server. +# ********************************************************************** +function send_file_secure { + FILE="$1" + + send_file "$FILE" + RC=$? + + # Always send the file to the secondary server + if [ "$SECONDARY_MODE" = "always" ]; then + switch_servers + send_file "$FILE" + switch_servers + # Send the file to the secondary server only if something went wrong + elif [ "$SECONDARY_MODE" = "on_error" ]; then + if [ $RC != 0 ]; then + switch_servers + send_file "$FILE" + RC=$? + switch_servers + fi + fi + + return $RC +} + # ********************************************************************** # function recv_file(file) # Gets a file from the server and saves it under $TEMP. Paths are not @@ -256,6 +315,29 @@ FEOF1 return 1 } +# ********************************************************************** +# function switch(var1, var2) +# Switches the values of var1 and var2 +# ********************************************************************** +function switch { + eval "TEMP=\"\$$1\"" + eval "$1=\"\$$2\"" + eval "$2=\"\$TEMP\"" +} + +# ********************************************************************** +# function switch_servers() +# Switches the target server +# ********************************************************************** +function switch_servers { + switch TRANSFER_MODE SECONDARY_TRANSFER_MODE + switch SERVER_IP SECONDARY_SERVER_IP + switch SERVER_PORT SECONDARY_SERVER_PORT + switch TENTACLE_OPTS SECONDARY_TENTACLE_OPTS + switch SERVER_PATH SECONDARY_SERVER_PATH + switch SERVER_PWD SECONDARY_SERVER_PWD +} + # ********************************************************************** # function check_remote_config() # Checks for a newer remote configuration file. @@ -273,15 +355,15 @@ function check_remote_config { return 1 fi - # Agent name md5sum - AGENT_MD5=`echo -n $NOMBRE_HOST | md5sum | cut -d" " -f1` + # Agent name md5 (md5sum is not available on Mac OS X except through Fink) + AGENT_MD5=`echo -n $NOMBRE_HOST | md5` CONFIG_FILE="$AGENT_MD5.conf" MD5_FILE="$AGENT_MD5.md5" - # Local config file md5sum - CONFIG_MD5=`md5sum $PANDORA_HOME/pandora_agent.conf | cut -d" " -f1` + # Local config file md5 (md5 has the hash on 4 instead of md5sum's 1) + CONFIG_MD5=`md5 $PANDORA_HOME/pandora_agent.conf | cut -d" " -f4` - # Get remote config file md5sum + # Get remote config file recv_file "$MD5_FILE" # Configuration has not been uploaded to the server @@ -373,7 +455,7 @@ OS_NAME=`uname -s` PANDORA_LOGFILE=/var/log/pandora/pandora_agent.log TEMP=/tmp -# Get Linux Distro type and version +# Check version if [ -f "/etc/SuSE-release" ] then OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "` @@ -486,7 +568,7 @@ do if [ ! -z "`echo $a | grep -e '^module_type'`" ] then mtype=`echo $a | awk '{ print $2 }' ` - if [ ! -z "`echo $mtype | grep 'generic_data_string'`" ] + if [ ! -z "`echo $mtype | grep 'generic_data_string'`" ] || [ ! -z "`echo $mtype | grep 'async_string'`" ] then flux_string=1 else @@ -555,7 +637,7 @@ do fi # Send packets to server and delete it - send_file $DATA + send_file_secure $DATA # Delete data rm -f $DATA > /dev/null 2> $PANDORA_LOGFILE.err @@ -563,10 +645,12 @@ do # Cron mode if [ "$CRON_MODE" == "1" ] then - exit + #remove pid file first + rm /tmp/pandora_agent_cron.pid + exit fi # Go to bed :-) sleep $INTERVAL done -# This runs forever! +# This runs forever! diff --git a/pandora_agents/mac_osx/pandora_agent.conf b/pandora_agents/mac_osx/pandora_agent.conf index a673f9d6b8..b2d8404839 100755 --- a/pandora_agents/mac_osx/pandora_agent.conf +++ b/pandora_agents/mac_osx/pandora_agent.conf @@ -8,30 +8,30 @@ # General Parameters # ================== -server_ip localhost -server_path /var/spool/pandora/data_in -temporal /var/spool/pandora/data_out -logfile /var/log/pandora/pandora_agent.log +server_ip localhost +server_path /var/spool/pandora/data_in +temporal /var/spool/pandora/data_out +logfile /var/log/pandora/pandora_agent.log # Interval in seconds, 300 by default -interval 300 +interval 300 # Debug mode only generate XML, and stop after first execution, # and does not copy XML to server. -debug 0 +debug 0 # By default, agent takes machine name #agent_name adama # By default agent try to take default encoding defined in host. -# encoding iso-8859-15 +# encoding iso-8859-15 # Listening TCP port for remote server. By default is 41121 (for tentacle) # if you want to use SSH use 22, and FTP uses 21. -server_port 41121 +server_port 41121 # Transfer mode: tentacle, ftp, ssh or local -transfer_mode local +transfer_mode tentacle # Server password (Tentacle or FTP). Leave empty for no password (default). # server_pwd mypassword @@ -57,8 +57,22 @@ transfer_mode local # cron_mode # If set to 1 allows the agent to be configured via the web console. -remote_config 0 +# remote_config 0 +# Secondary server configuration +# ============================== + +# If secondary_mode is set to on_error, data files are copied to the secondary +# server only if the primary server fails. If set to always, data files are +# always copied to the secondary server. +# secondary_mode on_error +# secondary_server_ip localhost +# secondary_server_path /var/spool/pandora/data_in +# secondary_server_port 41121 +# secondary_transfer_mode tentacle +# secondary_server_pwd mypassword +# secondary_server_ssl no +# secondary_server_opts # Module Definition # ================= @@ -68,7 +82,6 @@ remote_config 0 module_begin module_name CPU (User) module_type generic_data -module_interval 1 module_exec iostat -C | tail -1 | awk '{ print $10 }' module_max 100 module_min 0 diff --git a/pandora_agents/mac_osx/pandora_agent_installer b/pandora_agents/mac_osx/pandora_agent_installer index 1e6b3dad9a..87c79fe43d 100755 --- a/pandora_agents/mac_osx/pandora_agent_installer +++ b/pandora_agents/mac_osx/pandora_agent_installer @@ -1,13 +1,13 @@ #!/bin/bash # ********************************************************************** # Pandora FMS Agent - Generic Host Agent Installer -# GNU/Linux version -# (c) 2007 Sancho Lerena +# Mac OS X version +# (c) 2007-2008 Sancho Lerena # Please see http://pandora.sourceforge.net # This code is licensed under GPL 2.0 license. # ********************************************************************** -PI_VERSION=1.0 +PI_VERSION=2.0 PANDORA_BIN=/usr/bin/pandora_agent PANDORA_HOME=/usr/share/pandora_agent PANDORA_TEMP=/var/spool/pandora @@ -42,29 +42,35 @@ install () { if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ] then echo "Seems that default dir already exists. Please use --force to" - echo "force installer to install on $PANDORA_HOME" + echo "force installer to overwrite $PANDORA_HOME" exit - else - echo "Checking default dir $PANDORA_HOME..." + elif [ "$FORCE" = "1" ] + then + #Trying to create directories in case of upgrade + echo "Checking existing directories..." + mkdir $PANDORA_HOME 2> /dev/null + mkdir $PANDORA_TEMP 2> /dev/null + mkdir $PANDORA_TEMP/data_out 2> /dev/null + mkdir $PANDORA_CFG 2> /dev/null + mkdir /var/log/pandora 2> /dev/null + else + echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..." + mkdir $PANDORA_HOME + mkdir $PANDORA_TEMP + mkdir $PANDORA_TEMP/data_out + mkdir $PANDORA_CFG + mkdir /var/log/pandora fi if [ -f $PANDORA_BIN ] && [ "$FORCE" = "0" ] then echo "Seems that $PANDORA_BIN already exists. Please use --force to" - echo "force installer to reinstall overwriting it" + echo "force installer to overwrite it" exit else echo "Checking Pandora FMS Agent on $PANDORA_BIN...." fi - # Create directories - echo "Creating Pandora FMS Agent home directory at $PANDORA_HOME ..." - mkdir $PANDORA_HOME - mkdir $PANDORA_TEMP - mkdir $PANDORA_TEMP/data_out - mkdir $PANDORA_CFG - mkdir /var/log/pandora - # Create logfile if [ ! -z "`touch $PANDORA_LOG`" ] then @@ -84,9 +90,15 @@ install () { cp pandora_agent_daemon $PANDORA_HOME echo "Copying Pandora FMS Agent configuration file to $PANDORA_HOME/pandora_agent.conf..." - cp pandora_agent.conf $PANDORA_HOME - chmod 600 $PANDORA_HOME/pandora_agent.conf - + if [ -f $PANDORA_HOME/pandora_agent.conf ] + then + echo "Configuration file already exists. The new config will be in $PANDORA_HOME/pandora_agent.conf.new" + cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf.new + else + cp pandora_agent.conf $PANDORA_HOME + chmod 600 $PANDORA_HOME/pandora_agent.conf + fi + echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..." cp -r plugins $PANDORA_HOME chmod -R 700 $PANDORA_HOME/plugins diff --git a/pandora_agents/mac_osx/pandora_fms/StartupParameters.plist b/pandora_agents/mac_osx/pandora_fms/StartupParameters.plist index 2a1c6ae414..c0dc234aa4 100644 --- a/pandora_agents/mac_osx/pandora_fms/StartupParameters.plist +++ b/pandora_agents/mac_osx/pandora_fms/StartupParameters.plist @@ -1,9 +1,9 @@ - + Description - Pandora FMS Agent 1.3 (Mac) + Pandora FMS Agent 2.0 (Mac) OrderPreference None Provides @@ -15,6 +15,5 @@ Network Resolver - + - diff --git a/pandora_agents/mac_osx/plugins/SGE/README b/pandora_agents/mac_osx/plugins/SGE/README new file mode 100644 index 0000000000..d383d4fcee --- /dev/null +++ b/pandora_agents/mac_osx/plugins/SGE/README @@ -0,0 +1 @@ +This script can be used as a plugin in Pandora FMS. It will return an XML with the current status of an SGE cluster diff --git a/pandora_agents/mac_osx/plugins/SGE/SGEStatus.sh b/pandora_agents/mac_osx/plugins/SGE/SGEStatus.sh new file mode 100755 index 0000000000..9d76a89a13 --- /dev/null +++ b/pandora_agents/mac_osx/plugins/SGE/SGEStatus.sh @@ -0,0 +1,89 @@ +#!/bin/bash +############################################################################### +# +# Copyright (c) 2008 Evi Vanoost +# +# SGEStatus: A quick shell script that can be used as a Pandora plugin to +# display the SGE cluster status +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 3 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +############################################################################### + + +SGE_BIN="/RCBI/sge/bin/darwin-ppc" + +PENDING=$[`$SGE_BIN/qstat -s p | grep " qw " | wc -l`+0] +RUNNING=$[`$SGE_BIN/qstat -s a | grep " r " | wc -l`+0] +HOSTS=$[`qhost | wc -l`-3] +QUEUES=`qstat -g c | grep -v '\-\-\-' | grep -v "CLUSTER QUEUE" | awk '{print $1}'` +NUMQUEUE=0 + +echo " + Pending Jobs (Cluster) + $PENDING + generic_data + + Running Jobs (Cluster) + $RUNNING + generic_data + + Number of Hosts (Cluster) + $HOSTS + generic_data" + +for queue in $QUEUES +do + NUMQUEUE=$[$NUMQUEUE+1] + # CLUSTER QUEUE CQLOAD USED AVAIL TOTAL aoACDS cdsuE + # 64bit 0.15 0 8 22 0 14 + QINFO=`qstat -g c | grep $queue` + AVGLOAD=`echo $QINFO | awk '{print $2}'` + USEDSLOTS=`echo $QINFO | awk '{print $3}'` + AVAILSLOTS=`echo $QINFO | awk '{print $4}'` + TOTALSLOTS=`echo $QINFO | awk '{print $5}'` + ADMSTATUS=`echo $QINFO | awk '{print $6}'` + ERRSTATUS=`echo $QINFO | awk '{print $7}'` + echo " + Available Slots (Q: $queue) + $AVAILSLOTS + generic_data + + + Used Slots (Q: $queue) + $USEDSLOTS + generic_data + + + Total Slots (Q: $queue) + $TOTALSLOTS + generic_data + + + Average load (Q: $queue) + $AVGLOAD + generic_data + + + Slots in Status aoACDS (Q: $queue) + $ADMSTATUS + generic_data + + + Slots in Status cdsuE (Q: $queue) + $ERRSTATUS + generic_data + " +done + +echo " + Number of Queues + $NUMQUEUE + generic_data"