diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 0284845c5e..7248f3a7ad 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,15 @@ +2007-04-19 Sancho Lerena + + At the moment, only linux agent changes, need to be propagated to + other Unix agents: + + * Local development changes for pandora_agent.sh, and for + pandora_agent.conf. Will be changed for production release. + + * Added contrib dir. + + * Added installer: pandora_agent_installer + 2007-04-11 Manuel Arostegui * linux/pandora_agents.spec: Added links from diff --git a/pandora_agents/linux/pandora_agent.conf b/pandora_agents/linux/pandora_agent.conf index aac8447592..47aa0623ca 100755 --- a/pandora_agents/linux/pandora_agent.conf +++ b/pandora_agents/linux/pandora_agent.conf @@ -9,7 +9,7 @@ server_ip 192.168.50.1 server_path /var/spool/pandora/data_in -temporal /var/spool/pandora/data_out +temporal /tmp logfile /var/log/pandora_agent.log # Interval in seconds, 300 by default @@ -86,12 +86,6 @@ module_end # Process information -module_begin -module_name snort -module_type generic_proc -module_exec ps -Af | grep snort | grep -v "grep" | wc -l -module_end - module_begin module_name apache module_type generic_proc @@ -144,4 +138,28 @@ module_exec netstat -as | grep "connections reset due to unexpected SYN" | awk ' module_description Resets due to unexpected SYN module_end +module_begin +module_name PandoraNetwork_RAM +module_exec ps aux | grep pandora_network | head -1 | awk '{ print $6 }' +module_type generic_data +module_end + +module_begin +module_name PandoraNetwork_CPU +module_exec ps aux | grep pandora_network | head -1 | awk '{print $3}' +module_type generic_data +module_end + +module_begin +module_name PandoraDS_RAM +module_exec ps aux | grep pandora_server | head -1 | awk '{ print $6 }' +module_type generic_data +module_end + +module_begin +module_name PandoraDS_CPU +module_exec ps aux | grep pandora_server | head -1 | awk '{print $3}' +module_type generic_data +module_end + diff --git a/pandora_agents/linux/pandora_agent.sh b/pandora_agents/linux/pandora_agent.sh index 6875b3329d..0abb9c5c5a 100755 --- a/pandora_agents/linux/pandora_agent.sh +++ b/pandora_agents/linux/pandora_agent.sh @@ -7,8 +7,8 @@ # Este codigo esta licenciado bajo la licencia GPL 2.0. # This code is licensed under GPL 2.0 license. # ********************************************************************** -AGENT_VERSION=1.2.1 -AGENT_BUILD=070103 +AGENT_VERSION=1.3-dev +AGENT_BUILD=070320 if [ -z "$1" ] then @@ -146,8 +146,8 @@ fi # Script banner at start echo "Pandora FMS Agent $AGENT_VERSION (c) Sancho Lerena, and others 2007" -echo "This program is licensed under GPL Terms. http://pandora.sf.net" -echo "Running in $NOMBRE_HOST at $TIMESTAMP \n" +echo "This program is licensed under GPL2 Terms. http://pandora.sf.net" +echo "Running in $NOMBRE_HOST at $TIMESTAMP" echo " " if [ "$DEBUG_MODE" == "1" ] @@ -308,7 +308,8 @@ do fi # Send packets to server and detele it - scp -P $SERVER_PORT $PANDORA_FILES pandora@$SERVER_IP:$SERVER_PATH > /dev/null 2> $PANDORA_LOGFILE.err + #scp -P $SERVER_PORT $PANDORA_FILES pandora@$SERVER_IP:$SERVER_PATH > /dev/null 2> $PANDORA_LOGFILE.err + cp $PANDORA_FILES /opt/pandora_server/data_in # Delete data rm -f $PANDORA_FILES> /dev/null 2> $PANDORA_LOGFILE.err diff --git a/pandora_agents/linux/pandora_agent_installer b/pandora_agents/linux/pandora_agent_installer new file mode 100755 index 0000000000..76ef4196ca --- /dev/null +++ b/pandora_agents/linux/pandora_agent_installer @@ -0,0 +1,153 @@ +#!/bin/bash +# ********************************************************************** +# Pandora FMS Agent - Generic Host Agent Installer +# GNU/Linux version +# (c) 2007 Sancho Lerena +# Please see http://pandora.sourceforge.net +# this code is licensed under GPL 2.0 license. +# Este codigo esta licenciado bajo la licencia GPL 2.0. +# ********************************************************************** + +PI_VERSION=1.0 +PANDORA_BIN=/usr/bin/pandora_agent +PANDORAL_HOME=/usr/share/pandora +PANDORA_TEMP=/var/spool/pandora +PANDORA_CFG=/etc/pandora +PANDORA_LOG=/var/log/pandora_agent.log +PANDORA_STARTUP=/etc/init.d/pandora_agent_daemon +FORCE=0 +LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"` + +MODE=$1 + +if [ ! -f "pandora_agent" ] +then + echo " " + echo "You need to place pandora_agent file on main distribution directory before install" + echo " " + exit 1 +fi + +uninstall () { + echo "Removing Pandora FMS Agent..." + rm -Rf $PANDORA_BIN + rm -Rf $PANDORA_TEMP + rm -Rf $PANDORA_CFG + rm -Rf $PANDORA_STARTUP + rm -Rf $PANDORA_HOME + rm -Rf $PANDORA_LOG + echo "Done" +} + +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" + exit + else + echo "Checking default dir $PANDORA_HOME..." + 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" + 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 + + # Create logfile + if [ ! -z "`touch $PANDORA_LOG`" ] + then + echo "Seems to be a problem generating logfile ($PANDORA_LOG) please checkit"; + else + echo "Creating logfile at $PANDORA_LOG..." + fi + + echo "$LOG_TIMESTAMP Pandora FMS installer has created this file at startup" > $PANDORA_LOG + + # Copying agent and securing it + echo "Copying Pandora FMS Agent to $PANDORA_BIN..." + cp pandora_agent $PANDORA_BIN + chmod 700 $PANDORA_BIN + + echo "Copying Pandora FMS Agent contrib dir to $PANDORA_HOME/contrib..." + cp -R contrib $PANDORA_HOME + #echo "Copying Pandora FMS Agent util to $PANDORA_HOME/util..." + #cp -R util $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 + echo "Copying Pandora FMS Agent user configuration file to $PANDORA_HOME/pandora_user.conf..." + cp pandora_agent.conf $PANDORA_HOME + chmod 600 $PANDORA_HOME/pandora_user.conf + + echo "Linking Pandora FMS Agent configuration to $PANDORA_CFG/pandora_agent.conf..." + ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG + echo "Linking Pandora FMS Agent user configuration to $PANDORA_CFG/pandora_user.conf..." + ln -s $PANDORA_HOME/pandora_user.conf $PANDORA_CFG + + echo "Setting secure permissions and ownership for all Pandora FMS Agent files..." + chown -R root $PANDORA_HOME + chmod -R 700 $PANDORA_HOME/util + chmod -R 600 $PANDORA_TEMP/data_out + chmod -R 700 $PANDORA_HOME/contrib + chmod 640 $PANDORA_LOG + chgrp 3 $PANDORA_LOG + echo "Linking start-up daemon script at $PANDORA_STARTUP"; + ln -s $PANDORA_HOME/contrib/pandora_agent_daemon $PANDORA_STARTUP + chown -R root $PANDORA_BIN + echo "Done." + echo " " + echo "You have your startup script ready at $PANDORA_STARTUP" + echo "First you need to copy your public SSH keys ($HOME/.ssh/id_dsa)" + echo "under /home/pandora/.ssh/authorized_keys on your Pandora FMS Server host" + echo "You also need to setup your $PANDORA_CFG/pandora_agent.conf config file" + echo " " + +} + +help () { + echo " --force-install To force installation if already installed on system " + echo " --install To install Pandora FMS Agent on this system" + echo " --uninstall To uninstall and remove Pandora FMS Agent on this System" + echo " " +} + +# Script banner at start +echo " " +echo "Pandora FMS Agent Installer $PI_VERSION (c) 2007 Sancho Lerena" +echo "This program is licensed under GPL2 Terms. http://pandora.sourceforge.net" +echo " " + +case "$MODE" in + +'--force-install') + FORCE=1 + install + exit + ;; + +'--install') + install + exit + ;; + +'--uninstall') + uninstall + exit + ;; + +*) + help +esac +