2011-02-14 Sancho Lerena <slerena@artica.es>
* OpenWRT: Special files for OpenWRT/Perl version. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3830 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8d5553e3d2
commit
5ca2e7d0ae
|
@ -1,3 +1,7 @@
|
|||
2011-02-14 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* OpenWRT: Special files for OpenWRT/Perl version.
|
||||
|
||||
2011-02-10 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandora_agent: Detach threads to avoid excessive resource usage,
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
Perl Agent
|
||||
===========
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
This is the generic Unix package, developed in Perl. In order to use it, you need to install a few packages first. This will be done using opkg (command line packager tool):
|
||||
|
||||
opkg install perl
|
||||
opkg install perlbase-autoloader
|
||||
opkg install perlbase-base
|
||||
opkg install perlbase-config
|
||||
opkg install perlbase-errno
|
||||
opkg install perlbase-essential
|
||||
opkg install perlbase-fcntl
|
||||
opkg install perlbase-file
|
||||
opkg install perlbase-hostname
|
||||
opkg install perlbase-io
|
||||
opkg install perlbase-posix
|
||||
opkg install perlbase-selectsaver
|
||||
opkg install perlbase-socket
|
||||
opkg install perlbase-symbol
|
||||
opkg install perlbase-sys
|
||||
opkg install perlbase-tie
|
||||
opkg install perlbase-xsloader
|
||||
opkg install coreutils-nohup
|
||||
opkg install perlbase-getopt
|
||||
|
||||
Install procedure
|
||||
-----------------
|
||||
|
||||
Step 1 - Get the latest package and copy to /tmp, you can get the latest package at:
|
||||
|
||||
http://sourceforge.net/projects/pandora/files/Pandora%20FMS%203.2/Stable%20release/Unix%20%28Tarball%29/pandorafms_agent_unix-3.2.tar.gz/download
|
||||
|
||||
Note: You will get a special version of the launcher, you can get it from our SVN repository and replace the perl daemon launcher with this special version for OpenWRT. Just replace it after do the package install for the Unix/Perl generic agent.
|
||||
|
||||
Step 2 - Install it
|
||||
|
||||
cd /tmp
|
||||
tar xvzf pandorafms_agent_unix-3.2.tar.gz
|
||||
cd unix
|
||||
./pandora_agent --install
|
||||
|
||||
Step 3 - Create the startup link to run pandora agent when device restarts
|
||||
|
||||
ln -s /etc/init.d/pandora_agent_daemon /etc/rc.d/S99pandora_agent
|
||||
|
||||
Step 4 - Customize the agent name and server_ip for this device
|
||||
|
||||
vi /etc/pandora/pandora_agent.conf
|
||||
|
||||
Alter line "agent_name" for the devicename you want
|
||||
|
||||
Step 5 - Start it manually:
|
||||
|
||||
/etc/init.d/pandora_agent_daemon start
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Pandora FMS Embedded Agent, startup script
|
||||
# Copyright (c) 2011 Artica ST, <info@artica.es>
|
||||
# Tested on Busybox 1.13
|
||||
# v4.0 Build 110122
|
||||
# http://www.pandorafms.com
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
PANDORA_PATH=/etc/pandora
|
||||
DAEMON=/usr/bin/pandora_agent
|
||||
LOGFILE=/dev/null
|
||||
|
||||
# This function replace pidof
|
||||
# not working in the same way in different linux distros
|
||||
|
||||
pidof_pandora() {
|
||||
COLUMNS=250
|
||||
PANDORA_PID=`ps | grep $DAEMON | grep -v grep | head -1 | awk '{ print $1 }'`
|
||||
echo $PANDORA_PID
|
||||
}
|
||||
|
||||
if [ ! -f $DAEMON ]
|
||||
then
|
||||
echo "Pandora FMS Agent not found at $DAEMON, please check setup"
|
||||
exit
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
if [ ! -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Agent is currently running on this machine with PID $PANDORA_PID"
|
||||
echo "Cannot launch again. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
nohup $DAEMON $PANDORA_PATH 2> $LOGFILE &
|
||||
sleep 1
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
echo "Pandora FMS Agent is now running with PID $PANDORA_PID"
|
||||
;;
|
||||
|
||||
stop)
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
if [ -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Agent is not running, cannot stop it. Aborting now..."
|
||||
exit 1
|
||||
else
|
||||
echo "Stopping Pandora FMS Agent."
|
||||
kill $PANDORA_PID > /dev/null 2>&1
|
||||
fi
|
||||
;;
|
||||
|
||||
status)
|
||||
PANDORA_PID=`pidof_pandora`
|
||||
if [ -z "$PANDORA_PID" ]
|
||||
then
|
||||
echo "Pandora FMS Agent is not running."
|
||||
else
|
||||
echo "Pandora FMS Agent is running with PID $PANDORA_PID."
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
|
||||
force-reload|restart)
|
||||
$0 stop
|
||||
sleep 2
|
||||
$0 start
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: /etc/init.d/pandora_agent_daemon {start|stop|restart|status|force-reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
Loading…
Reference in New Issue