2009-09-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
* mac_osx/pandora_fms/pandora_fms, mac_osx/pandora_fms/StartupParameters.plist: Updated for 3.0 * mac_osx/tentacle_client: Added for 3.0 * mac_osx/pandora_agent: Copied from Linux and modified * mac_osx/pandora_agent.conf: Slight modifications for 3.0 * mac_osx/pandora_agent_installer: Copied from Linux and modified * mac_osx/Pandora FMS.pmdoc: PackageMaker definition file to create Mac Packages for easy (automatic) deployment * mac_osx/Pandora Agent 3.0 for Mac: Package (installer) for Mac. This is an easy (click-to-run) package. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1975 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
aad347a553
commit
019f6b6e28
|
@ -1,3 +1,24 @@
|
|||
2009-09-25 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
|
||||
* mac_osx/pandora_fms/pandora_fms,
|
||||
mac_osx/pandora_fms/StartupParameters.plist: Updated for 3.0
|
||||
|
||||
* mac_osx/tentacle_client: Added for 3.0
|
||||
|
||||
* mac_osx/pandora_agent: Copied from Linux and modified
|
||||
|
||||
* mac_osx/pandora_agent.conf: Slight modifications for 3.0
|
||||
|
||||
* mac_osx/pandora_agent_installer: Copied from Linux and
|
||||
modified
|
||||
|
||||
* mac_osx/Pandora FMS.pmdoc: PackageMaker definition file
|
||||
to create Mac Packages for easy (automatic) deployment
|
||||
|
||||
* mac_osx/Pandora Agent 3.0 for Mac: Package (installer) for
|
||||
Mac. This is an easy (click-to-run) package.
|
||||
|
||||
|
||||
2009-09-24 Sancho Lerena zslerena@artica.es>
|
||||
|
||||
* linux/agent_installer: Fixed a typo in old setup backup cmd.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<pkg-contents spec="1.12"><f n="/" o="root" g="admin" p="17405" pt="/" m="true" t="fsevent"><f n="Library" o="root" g="admin" p="17405"><f n="StartupItems" o="root" g="admin" p="16877"><f n="pandora_fms" o="root" g="admin" p="16877"><f n="pandora_fms" o="root" g="admin" p="33261"/><f n="StartupParameters.plist" o="root" g="admin" p="33188"/></f></f></f><f n="private" o="root" g="wheel" p="16877"><f n="etc" o="root" g="wheel" p="16877"><f n="pandora" o="root" g="wheel" p="16877"><f n="pandora_agent.conf" o="root" g="wheel" p="41380"><mod>mode</mod></f><f n="plugins" o="root" g="wheel" p="41453"/></f></f><f n="var" o="root" g="wheel" p="16877"><f n="log" o="root" g="wheel" p="16877"><f n="pandora" o="root" g="wheel" p="16877"/></f></f></f><f n="usr" o="root" g="wheel" p="16877"><f n="bin" o="root" g="wheel" p="16877"><f n="pandora_agent" o="root" g="wheel" p="33261"><mod>mode</mod></f><f n="tentacle_client" o="root" g="wheel" p="33261"><mod>mode</mod></f></f><f n="share" o="root" g="wheel" p="16877"><f n="pandora_agent" o="root" g="wheel" p="16832"><f n="pandora_agent.conf" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="plugins" o="root" g="wheel" p="16832"><f n="SGE" o="root" g="wheel" p="16832"><f n="README" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="SGEStatus.sh" o="root" g="wheel" p="33216"><mod>mode</mod></f><mod>mode</mod></f><f n="XServeRAID" o="root" g="wheel" p="16832"><f n="check_xserve" o="root" g="wheel" p="33216"><mod>mode</mod></f><f n="pandora_agent.conf" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="README.txt" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="xserve-raid-tools-1.2-1.rhel3.i386.rpm" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm" o="root" g="wheel" p="33152"><mod>mode</mod></f><f n="xserve-raid-tools-1.2.tar.gz" o="root" g="wheel" p="33152"><mod>mode</mod></f><mod>mode</mod></f><f n="ipmi2xml" o="root" g="wheel" p="16832"><f n="ipmi2xml.php" o="root" g="wheel" p="33216"><mod>mode</mod></f><f n="README.txt" o="root" g="wheel" p="33152"><mod>mode</mod></f><mod>mode</mod></f><f n="grep_log" o="root" g="wheel" p="33216"><mod>mode</mod></f><f n="ppc_sensors" o="root" g="wheel" p="33216"><mod>mode</mod></f><mod>mode</mod></f><mod>mode</mod></f></f></f></f></pkg-contents>
|
|
@ -0,0 +1 @@
|
|||
<pkgref spec="1.12" uuid="BAB308AF-4BA3-4C63-8328-AFF1EBD9C07F"><config><identifier>org.pandorafms.pandoraAgent30ForMac.pandoraInstaller.pkg</identifier><version>1</version><description/><post-install type="none"/><requireAuthorization/><installTo>/</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"/><mod>parent</mod><mod>installTo</mod></config><contents><file-list>01pandora-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents><extra><title>Pandora Installer</title></extra></pkgref>
|
|
@ -0,0 +1,120 @@
|
|||
<pkmkdoc spec="1.12"><properties><title>Pandora Agent 3.0 for Mac</title><build>/Volumes/rcbiUsers/vanooste/Pandora/trunk/pandora_agents/mac_osx/Pandora Agent 3.0 for Mac.mpkg</build><organization>org.pandorafms</organization><userSees ui="easy"/><min-target os="2"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="Pandora Installer" id="choice0" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.pandorafms.pandoraAgent30ForMac.pandoraInstaller.pkg"/></choice></contents><resources bg-scale="tofit" bg-align="topleft"><locale lang="en"><resource type="background">/Volumes/rcbiUsers/vanooste/Pandora/trunk/pandora_console/images/pandora_logo_head.png</resource><resource mime-type="text/rtf" kind="embedded" type="license"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
|
||||
{\fonttbl\f0\fnil\fcharset0 Monaco;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\deftab480
|
||||
\pard\tx480\pardeftab480\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\fs20 \cf0 \CocoaLigature0 GNU GENERAL PUBLIC LICENSE\
|
||||
\
|
||||
Version 2, June 1991\
|
||||
\
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc. \
|
||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA\
|
||||
\
|
||||
Everyone is permitted to copy and distribute verbatim copies\
|
||||
of this license document, but changing it is not allowed.\
|
||||
\
|
||||
Preamble\
|
||||
\
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.\
|
||||
\
|
||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.\
|
||||
\
|
||||
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.\
|
||||
\
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.\
|
||||
\
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.\
|
||||
\
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.\
|
||||
\
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.\
|
||||
\
|
||||
The precise terms and conditions for copying, distribution and modification follow.\
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\
|
||||
\
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".\
|
||||
\
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.\
|
||||
\
|
||||
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.\
|
||||
\
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.\
|
||||
\
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:\
|
||||
\
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \
|
||||
\
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \
|
||||
\
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \
|
||||
\
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.\
|
||||
\
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.\
|
||||
\
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.\
|
||||
\
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:\
|
||||
\
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \
|
||||
\
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \
|
||||
\
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \
|
||||
\
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.\
|
||||
\
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.\
|
||||
\
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.\
|
||||
\
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.\
|
||||
\
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.\
|
||||
\
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.\
|
||||
\
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.\
|
||||
\
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.\
|
||||
\
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.\
|
||||
\
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.\
|
||||
\
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.\
|
||||
\
|
||||
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.\
|
||||
\
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.\
|
||||
\
|
||||
NO WARRANTY\
|
||||
\
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\
|
||||
\
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\
|
||||
\
|
||||
END OF TERMS AND CONDITIONS}]]></resource><resource mime-type="text/rtf" kind="embedded" type="welcome"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
|
||||
{\fonttbl\f0\fnil\fcharset0 Monaco;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\deftab480
|
||||
\pard\tx480\pardeftab480\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\fs20 \cf0 \CocoaLigature0 Pandora FMS is a monitoring application to watch systems and applications. Pandora FMS allows you to know the status of any element of your business systems.\
|
||||
\
|
||||
Pandora FMS watches your hardware, your software, your multilayer system and, of course, your Operating System. Pandora FMS can detect a network interface down or the movement of any NASDAQ new technology market value. If you wish, Pandora FMS can send a SMS message when your system or your application fails... or when\
|
||||
Google stock value drops below 330 US$.\
|
||||
\
|
||||
Pandora FMS will adjust, like an octopus, to your systems and requirements, because it has been designed to be open, modular, multi-platform and easy to customize. Pandora FMS is developed for system administrators.\
|
||||
\
|
||||
This installer will install a Pandora FMS agent on your system.\
|
||||
}]]></resource><resource mime-type="text/rtf" kind="embedded" type="conclusion"><![CDATA[{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf540
|
||||
{\fonttbl\f0\fnil\fcharset0 Monaco;}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\deftab480
|
||||
\pard\tx480\pardeftab480\ql\qnatural\pardirnatural
|
||||
|
||||
\f0\fs20 \cf0 \CocoaLigature0 Thank you for installing Pandora FMS Agent 3.0 for Mac\
|
||||
\
|
||||
Configuration still has to be done manually by editing /etc/pandora/pandora_agent.conf}]]></resource></locale></resources><flags/><extra-files/><item type="snapshot">01pandora.xml</item><mod>properties.customizeOption</mod><mod>extraFiles</mod><mod>properties.title</mod><mod>properties.systemDomain</mod><mod>properties.anywhereDomain</mod></pkmkdoc>
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
# **********************************************************************
|
||||
# Pandora FMS Generic MacOS Agent
|
||||
# (c) 2009 Artica Soluciones Tecnológicas SL
|
||||
# Pandora FMS Generic Linux Agent
|
||||
# (c) 2009 Artica Soluciones Tecnológicas
|
||||
# with the help of many people. Please see http://pandorafms.org
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
AGENT_VERSION=2.0
|
||||
AGENT_BUILD=081211
|
||||
AGENT_VERSION=3.0
|
||||
AGENT_BUILD=090818
|
||||
|
||||
# **********************************************************************
|
||||
# function configure_agent()
|
||||
|
@ -91,7 +91,7 @@ function configure_agent {
|
|||
elif [ ! -z "`echo $a | grep -e '^cron_mode'`" ]
|
||||
then
|
||||
CRON_MODE=1
|
||||
echo "$TIMESTAMP - [SETUP] - Scheduled mode enabled" >> $PANDORA_LOGFILE
|
||||
echo "$TIMESTAMP - [SETUP] - Cronmode enabled" >> $PANDORA_LOGFILE
|
||||
elif [ ! -z "`echo $a | grep -e '^server_opts'`" ]
|
||||
then
|
||||
SERVER_OPTS=`echo $a | cut -d" " -f2-`
|
||||
|
@ -153,27 +153,37 @@ function configure_agent {
|
|||
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
|
||||
# Agent description
|
||||
elif [ ! -z "`echo $a | grep -e '^description'`" ]
|
||||
then
|
||||
AGENT_DESCRIPTION=`echo $a | cut -d" " -f2-`
|
||||
# Agent group
|
||||
elif [ ! -z "`echo $a | grep -e '^group'`" ]
|
||||
then
|
||||
AGENT_GROUP=`echo $a | cut -d" " -f2-`
|
||||
|
||||
# Agent autotime (use always current server time)
|
||||
elif [ ! -z "`echo $a | grep -e '^autotime'`" ]
|
||||
then
|
||||
AGENT_AUTOTIME=`echo $a | cut -d" " -f2-`
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$CRON_MODE" == "0" ]
|
||||
then
|
||||
# Script banner at start
|
||||
echo "Pandora FMS Agent $AGENT_VERSION (c) Sancho Lerena 2003-2008"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandora.sf.net"
|
||||
echo "Pandora FMS Agent $AGENT_VERSION (c) Artica ST 2003-2009"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.org"
|
||||
echo "Running in $NOMBRE_HOST at $TIMESTAMP"
|
||||
echo " "
|
||||
else
|
||||
# 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`
|
||||
# Checks if there is another instance running
|
||||
PID_RUNNING=`pidof -x pandora_agent`
|
||||
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
|
||||
|
||||
|
@ -354,15 +364,15 @@ function check_remote_config {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Agent name md5 (md5sum is not available on Mac OS X except through Fink)
|
||||
AGENT_MD5=`echo -n $NOMBRE_HOST | md5`
|
||||
# Agent name md5sum
|
||||
AGENT_MD5=`echo -n $NOMBRE_HOST | md5sum | cut -d" " -f1`
|
||||
CONFIG_FILE="$AGENT_MD5.conf"
|
||||
MD5_FILE="$AGENT_MD5.md5"
|
||||
|
||||
# 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`
|
||||
# Local config file md5sum
|
||||
CONFIG_MD5=`md5sum $PANDORA_HOME/pandora_agent.conf | cut -d" " -f1`
|
||||
|
||||
# Get remote config file
|
||||
# Get remote config file md5sum
|
||||
recv_file "$MD5_FILE"
|
||||
|
||||
# Configuration has not been uploaded to the server
|
||||
|
@ -454,33 +464,35 @@ OS_NAME=`uname -s`
|
|||
PANDORA_LOGFILE=/var/log/pandora/pandora_agent.log
|
||||
TEMP=/tmp
|
||||
|
||||
# Check version
|
||||
# Get Linux Distro type and version
|
||||
if [ -f "/etc/SuSE-release" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "`
|
||||
LINUX_DISTRO=SUSE
|
||||
elif [ -f "/etc/lsb-release" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="`
|
||||
LINUX_DISTRO=UBUNTU
|
||||
OS_VERSION="UBUNTU $OS_VERSION"
|
||||
elif [ -f "/etc/debian_version" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/debian_version`
|
||||
OS_VERSION="DEBIAN $OS_VERSION"
|
||||
LINUX_DISTRO=DEBIAN
|
||||
elif [ -f "/etc/fedora-release" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
|
||||
OS_VERSION="FEDORA $OS_VERSION"
|
||||
LINUX_DISTRO=FEDORA
|
||||
elif [ $OS_NAME = "Darwin" ]
|
||||
then
|
||||
LINUX_DISTRO="Mac OS X"
|
||||
OS_VERSION=`sw_vers | awk 'NR==2 {print $2}'`
|
||||
OS_VERSION=`cat /etc/SuSE-release | grep VERSION | cut -f 3 -d " "`
|
||||
LINUX_DISTRO=SUSE
|
||||
else
|
||||
LINUX_DISTRO=$OS_NAME
|
||||
OS_VERSION=`uname -r`
|
||||
if [ -f "/etc/lsb-release" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/lsb-release | grep DISTRIB_RELEASE | cut -f 2 -d "="`
|
||||
LINUX_DISTRO=UBUNTU
|
||||
OS_VERSION="UBUNTU $OS_VERSION"
|
||||
else
|
||||
if [ -f "/etc/debian_version" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/debian_version`
|
||||
OS_VERSION="DEBIAN $OS_VERSION"
|
||||
LINUX_DISTRO=DEBIAN
|
||||
else
|
||||
if [ -f "/etc/fedora-release" ]
|
||||
then
|
||||
OS_VERSION=`cat /etc/fedora-release | cut -f 4 -d " "`
|
||||
OS_VERSION="FEDORA $OS_VERSION"
|
||||
LINUX_DISTRO=FEDORA
|
||||
else
|
||||
LINUX_DISTRO=GENERIC
|
||||
OS_VERSION=`uname -r`
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configure this agent
|
||||
|
@ -499,6 +511,11 @@ do
|
|||
# Date and time, SERIAL is number of seconds since 1/1/1970, for every packet.
|
||||
TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
SERIAL=`date +"%s"`
|
||||
if [ "$AGENT_AUTOTIME" == "1" ]
|
||||
then
|
||||
TIMESTAMP="AUTO"
|
||||
fi
|
||||
|
||||
|
||||
# File names
|
||||
DATA=$TEMP/$NOMBRE_HOST.$SERIAL.data
|
||||
|
@ -506,7 +523,7 @@ do
|
|||
|
||||
# Makes data packet
|
||||
echo "<?xml version=\"1.0\" encoding=\"$ENCODING\"?> " > $DATA
|
||||
echo "<agent_data os_name='$OS_NAME' os_version='$OS_VERSION' interval='$INTERVAL' version='$AGENT_VERSION' timestamp='$TIMESTAMP' agent_name='$NOMBRE_HOST'>" >> $DATA
|
||||
echo "<agent_data description='$AGENT_DESCRIPTION' group='$AGENT_GROUP' os_name='$OS_NAME' os_version='$OS_VERSION' interval='$INTERVAL' version='$AGENT_VERSION' timestamp='$TIMESTAMP' agent_name='$NOMBRE_HOST'>" >> $DATA
|
||||
|
||||
for a in `cat $PANDORA_HOME/pandora_agent.conf | grep -v -e "^#" | grep -e "^module" `
|
||||
do
|
||||
|
@ -597,6 +614,13 @@ do
|
|||
fi
|
||||
fi
|
||||
|
||||
# Module postprocess info
|
||||
if [ ! -z "`echo $a | grep -e '^module_postprocess'`" ]
|
||||
then
|
||||
pprocess=`echo $a | cut -d" " -f2-`
|
||||
echo "<postprocess><![CDATA[$pprocess]]></postprocess>" >> $DATA2
|
||||
fi
|
||||
|
||||
# If module ends, and execute for this module is enabled
|
||||
# then write
|
||||
|
||||
|
@ -644,12 +668,10 @@ do
|
|||
# Cron mode
|
||||
if [ "$CRON_MODE" == "1" ]
|
||||
then
|
||||
#remove pid file first
|
||||
rm /tmp/pandora_agent_cron.pid
|
||||
exit
|
||||
exit
|
||||
fi
|
||||
|
||||
# Go to bed :-)
|
||||
sleep $INTERVAL
|
||||
done
|
||||
# This runs forever!
|
||||
# This runs forever!
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 2.0
|
||||
# Version 3.0
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2008 Artica Soluciones Tecnologicas
|
||||
# (c) 2003-2008 Sancho Lerena <slerena@gmail.com>
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
# General Parameters
|
||||
|
@ -23,6 +22,17 @@ debug 0
|
|||
# By default, agent takes machine name
|
||||
#agent_name adama
|
||||
|
||||
# Agent description
|
||||
#description Demo agent
|
||||
|
||||
# Group assigned for this agent (descriptive, p.e: Servers)
|
||||
#group Servers
|
||||
|
||||
# Autotime: Enforce to server to ignore timestamp coming from this
|
||||
# agent, used when agents has no timer or it's inestable. 1 to enable
|
||||
# this feature
|
||||
# autotime 1
|
||||
|
||||
# By default agent try to take default encoding defined in host.
|
||||
# encoding iso-8859-15
|
||||
|
||||
|
@ -56,8 +66,8 @@ transfer_mode tentacle
|
|||
# is much more safe.
|
||||
# cron_mode
|
||||
|
||||
# If set to 1 allows the agent to be configured via the web console.
|
||||
# remote_config 0
|
||||
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
|
||||
# remote_config 1
|
||||
|
||||
# Secondary server configuration
|
||||
# ==============================
|
||||
|
@ -82,7 +92,7 @@ transfer_mode tentacle
|
|||
module_begin
|
||||
module_name CPU (User)
|
||||
module_type generic_data
|
||||
module_exec iostat -C | tail -1 | awk '{ print $10 }'
|
||||
module_exec iostat -C | tail -1 | awk '{ print $4 }'
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_descripcion User CPU Usage (%)
|
||||
|
@ -91,37 +101,19 @@ module_end
|
|||
module_begin
|
||||
module_name CPU (System)
|
||||
module_type generic_data
|
||||
module_exec iostat -C | tail -1 | awk '{ print $11 }'
|
||||
module_exec iostat -C | tail -1 | awk '{ print $5 }'
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description System CPU Usage (%)
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_name Disk Space on / (Available)
|
||||
module_name Disk Space on / (% Available)
|
||||
module_type generic_data
|
||||
module_exec df -kh / | tail -1 | awk '{ print 100-$5 }'
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description Free disk Percentage of root partition
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_name Disk Space on /Volumes/Backup (Available)
|
||||
module_type generic_data
|
||||
module_exec df -kh /Volumes/Backup | tail -1 | awk '{ print 100-$5 }'
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description Free disk Percentage of /Volumes/Backup partition
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
module_name Disk Space on /Volumes/Backup-MJ (Available)
|
||||
module_type generic_data
|
||||
module_exec df -kh /Volumes/Backup-MJ | tail -1 | awk '{ print 100-$5 }'
|
||||
module_max 100
|
||||
module_min 0
|
||||
module_description Free disk Percentage of /Volumes/Backup-MJ partition
|
||||
module_description Free disk percentage of root partition
|
||||
module_end
|
||||
|
||||
module_begin
|
||||
|
@ -231,21 +223,21 @@ module_end
|
|||
#module_description DHCP & BOOTP server
|
||||
#module_end
|
||||
|
||||
module_begin
|
||||
module_name DNS
|
||||
module_type generic_proc
|
||||
module_exec ps -A | grep "sbin\/named" | wc -l
|
||||
module_description DNS Server
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name DNS
|
||||
#module_type generic_proc
|
||||
#module_exec ps -A | grep "sbin\/named" | wc -l
|
||||
#module_description DNS Server
|
||||
#module_end
|
||||
|
||||
# You should have alerts in case the number of rules change
|
||||
|
||||
module_begin
|
||||
module_name Firewall Status
|
||||
module_type generic_data
|
||||
module_exec ipfw show | wc -l
|
||||
module_description Firewall (number of rules)
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name Firewall Status
|
||||
#module_type generic_data
|
||||
#module_exec ipfw show | wc -l
|
||||
#module_description Firewall (number of rules)
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_name FTP
|
||||
|
@ -318,12 +310,12 @@ module_end
|
|||
#module_description NFS File Server
|
||||
#module_end
|
||||
|
||||
module_begin
|
||||
module_name Open Directory
|
||||
module_type generic_proc
|
||||
module_exec ps -A | grep "bin\/krb5kdc" | wc -l
|
||||
module_description Open Directory
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name Open Directory
|
||||
#module_type generic_proc
|
||||
#module_exec ps -A | grep "bin\/krb5kdc" | wc -l
|
||||
#module_description Open Directory
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_name Print
|
||||
|
@ -339,12 +331,12 @@ module_end
|
|||
#module_description QT Streaming Service
|
||||
#module_end
|
||||
|
||||
module_begin
|
||||
module_name Software Update
|
||||
module_type generic_proc
|
||||
module_exec ps -A | grep "etc\/swupd" | wc -l
|
||||
module_description Software Update
|
||||
module_end
|
||||
#module_begin
|
||||
#module_name Software Update
|
||||
#module_type generic_proc
|
||||
#module_exec ps -A | grep "etc\/swupd" | wc -l
|
||||
#module_description Software Update
|
||||
#module_end
|
||||
|
||||
#module_begin
|
||||
#module_name VPN
|
||||
|
@ -381,5 +373,13 @@ module_end
|
|||
#module_description XGrid
|
||||
#module_end
|
||||
|
||||
# Plugin Section #
|
||||
module_plugin ppc_sensors
|
||||
# Plugin example
|
||||
|
||||
# This parses /var/log/syslog file, under the module name "syslog"
|
||||
# And search for "ssh" string into it, sending only that information.
|
||||
|
||||
module_plugin grep_log /var/log/syslog Syslog ssh
|
||||
|
||||
# Plugin for inventory on the agent (Only Enterprise)
|
||||
|
||||
# module_plugin inventory 1 cpu ram video nic hd cdrom software
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
#!/bin/bash
|
||||
# **********************************************************************
|
||||
# Pandora FMS Agent - Generic Host Agent Installer
|
||||
# Mac OS X version
|
||||
# (c) 2007-2008 Sancho Lerena <slerena@gmail.com>
|
||||
# Please see http://pandora.sourceforge.net
|
||||
|
||||
# Pandora FMS Agent Installer (c) 2008-2009 Artica ST
|
||||
# Linux Version (generic), for SuSe and Debian/Ubuntu only
|
||||
# other Linux distros could not work properly without modifications
|
||||
# Please see http://www.pandorafms.org
|
||||
# v3.0 Build 090810
|
||||
# This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION=2.0
|
||||
PI_VERSION=3.0
|
||||
PANDORA_BIN=/usr/bin/pandora_agent
|
||||
PANDORA_HOME=/usr/share/pandora_agent
|
||||
PANDORA_TEMP=/var/spool/pandora
|
||||
PANDORA_CFG=/etc/pandora
|
||||
PANDORA_LOG=/var/log/pandora/pandora_agent.log
|
||||
PANDORA_STARTUP=/Library/StartupItems/pandora_fms
|
||||
PANDORA_STARTUP=/Library/StartupItems/
|
||||
TENTACLE=/usr/bin/tentacle_client
|
||||
PANDORA_CFG_FILE=/etc/pandora/pandora_agent.conf
|
||||
|
||||
FORCE=0
|
||||
LOG_TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
|
||||
|
||||
|
@ -27,50 +31,59 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
get_distro () {
|
||||
LINUX_DISTRO=`uname -s`
|
||||
OS_VERSION=`uname -r`
|
||||
|
||||
echo $LINUX_DISTRO
|
||||
}
|
||||
|
||||
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_CFG_FILE
|
||||
rm -Rf $PANDORA_STARTUP"pandora_fms"
|
||||
rm -Rf $PANDORA_HOME
|
||||
rm -Rf $PANDORA_LOG
|
||||
rm -Rf $TENTACLE
|
||||
echo "Done"
|
||||
}
|
||||
|
||||
install () {
|
||||
|
||||
DISTRO=`get_distro`
|
||||
OLDFILENAMETMP=`date +"%Y-%m-%d"`
|
||||
|
||||
echo "Detected Operating System: $DISTRO"
|
||||
|
||||
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
|
||||
then
|
||||
echo "Seems that default dir already exists. Please use --force to"
|
||||
echo "force installer to overwrite $PANDORA_HOME"
|
||||
echo "force installer to install on $PANDORA_HOME"
|
||||
exit
|
||||
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
|
||||
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 overwrite it"
|
||||
echo "force installer to reinstall overwriting it"
|
||||
echo " "
|
||||
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 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
|
||||
|
||||
# Create logfile
|
||||
if [ ! -z "`touch $PANDORA_LOG`" ]
|
||||
then
|
||||
|
@ -84,44 +97,51 @@ install () {
|
|||
# Copying agent and securing it
|
||||
echo "Copying Pandora FMS Agent to $PANDORA_BIN..."
|
||||
cp pandora_agent $PANDORA_BIN
|
||||
chmod 700 $PANDORA_BIN
|
||||
#chmod 700 $PANDORA_BIN
|
||||
|
||||
echo "Copying Pandora FMS Agent contrib dir to $PANDORA_HOME/..."
|
||||
cp pandora_agent_daemon $PANDORA_HOME
|
||||
|
||||
echo "Copying Pandora FMS Agent configuration file to $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
|
||||
|
||||
if [ -e /etc/pandora/pandora_agent.conf ]
|
||||
then
|
||||
cat /etc/pandora/pandora_agent.conf > /etc/pandora/pandora/pandora_agent.conf.$OLDFILENAMETMP
|
||||
echo "Backing up old configuration file to /etc/pandora_agent.conf.$OLDFILENAMETMP"
|
||||
fi
|
||||
|
||||
echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf"
|
||||
cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf
|
||||
#chmod 600 $PANDORA_HOME/pandora_agent.conf
|
||||
|
||||
echo "Copying Pandora FMS Agent plugins to $PANDORA_HOME/plugins..."
|
||||
cp -r plugins $PANDORA_HOME
|
||||
chmod -R 700 $PANDORA_HOME/plugins
|
||||
#chmod -R 700 $PANDORA_HOME/plugins
|
||||
|
||||
echo "Copying tentacle client to $TENTACLE"
|
||||
cp tentacle_client $TENTACLE
|
||||
|
||||
echo "Linking Pandora FMS Agent plugins directory to $PANDORA_CFG/plugins..."
|
||||
ln -s $PANDORA_HOME/plugins $PANDORA_CFG
|
||||
rm $PANDORA_CFG/plugins 2> /dev/null
|
||||
ln -s $PANDORA_HOME/plugins $PANDORA_CFG 2> /dev/null
|
||||
|
||||
echo "Linking Pandora FMS Agent configuration to $PANDORA_CFG/pandora_agent.conf..."
|
||||
ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG
|
||||
|
||||
rm $PANDORA_CFG/pandora_agent.conf 2> /dev/null
|
||||
ln -s $PANDORA_HOME/pandora_agent.conf $PANDORA_CFG/pandora_agent.conf
|
||||
|
||||
echo "Setting secure permissions and ownership for all Pandora FMS Agent files..."
|
||||
chown -R root $PANDORA_HOME
|
||||
chmod -R 600 $PANDORA_TEMP/data_out
|
||||
#chmod -R 600 $PANDORA_TEMP/data_out
|
||||
chmod 640 $PANDORA_LOG
|
||||
chgrp 3 $PANDORA_LOG
|
||||
echo "Copying start-up daemon script at $PANDORA_STARTUP";
|
||||
chgrp root $PANDORA_LOG
|
||||
|
||||
echo "Linking start-up daemon script at $PANDORA_STARTUP";
|
||||
cp -R pandora_fms $PANDORA_STARTUP
|
||||
chown -R root:wheel $PANDORA_STARTUP
|
||||
chmod -R 744 $PANDORA_STARTUP
|
||||
chown -R root $PANDORA_BIN
|
||||
|
||||
chown -R root: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 " "
|
||||
echo "Tentacle is the default transfer mode since 2.0 version."
|
||||
echo "If you want to use SSH, firstly 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 " "
|
||||
|
@ -137,8 +157,8 @@ help () {
|
|||
|
||||
# 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 "Pandora FMS Agent Installer $PI_VERSION (c) 2008-2009 ArticaST"
|
||||
echo "This program is licensed under GPL2 Terms. http://pandorafms.com"
|
||||
echo " "
|
||||
|
||||
case "$MODE" in
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Description</key>
|
||||
<string>Pandora FMS Agent 2.0 (Mac)</string>
|
||||
<string>Pandora FMS Agent 3.0 (Mac)</string>
|
||||
<key>OrderPreference</key>
|
||||
<string>None</string>
|
||||
<key>Provides</key>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Generic GNU/Linux version
|
||||
# (c) Sancho Lerena, <slerena@gmail.com>
|
||||
# (c) Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||
# v2.0
|
||||
# v3.0
|
||||
|
||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
|
||||
PANDORA_PATH=/etc/pandora
|
||||
|
@ -32,8 +32,8 @@ StartService()
|
|||
fi
|
||||
fi
|
||||
|
||||
nohup $DAEMON $PANDORA_PATH 2> $LOGFILE & MYPID=$!
|
||||
echo $MYPID > $PIDFILE
|
||||
$DAEMON $PANDORA_PATH > $LOGFILE 2>&1 &
|
||||
echo $! > $PIDFILE
|
||||
echo "Pandora FMS Agent is now running with PID $MYPID"
|
||||
}
|
||||
|
||||
|
@ -41,15 +41,15 @@ StopService()
|
|||
{
|
||||
if [ -f $PIDFILE ]
|
||||
then
|
||||
echo "Stopping Pandora Agent."
|
||||
PID_2=`cat $PIDFILE`
|
||||
if [ ! -z "`ps -A | grep -v grep | grep 'pandora_agent'`" ]
|
||||
then
|
||||
kill -9 $PID_2
|
||||
fi
|
||||
rm -f $PIDFILE
|
||||
echo "Stopping Pandora Agent."
|
||||
PID_BA=`cat $PIDFILE`
|
||||
if [ ! -z "`ps -A | grep -v grep | grep 'pandora_agent'`" ]
|
||||
then
|
||||
kill $PID_BA
|
||||
fi
|
||||
rm -f $PIDFILE
|
||||
else
|
||||
echo "Pandora FMS Agent is not running, cannot stop it. Aborting now..."
|
||||
echo "Pandora FMS Agent is not running, cannot stop it. Aborting now..."
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,682 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
|
||||
if 0; # not running under some shell
|
||||
################################################################################
|
||||
#
|
||||
# Copyright (c) 2007-2008 Ramon Novoa <rnovoa@artica.es>
|
||||
# Copyright (c) 2007-2008 Artica Soluciones Tecnologicas S.L.
|
||||
#
|
||||
# tentacle_client.pl Tentacle Client. See http://www.openideas.info/wiki for
|
||||
# protocol description.
|
||||
#
|
||||
# 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 2 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.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
package tentacle::client;
|
||||
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Getopt::Std;
|
||||
use IO::Select;
|
||||
use IO::Socket::INET;
|
||||
|
||||
# Program version
|
||||
our $VERSION = '0.2.0';
|
||||
|
||||
# Server address
|
||||
my $t_address = '127.0.0.1';
|
||||
|
||||
# Block size for socket read/write operations in bytes
|
||||
my $t_block_size = 1024;
|
||||
|
||||
# Log messages, 1 enabled, 0 disabled
|
||||
my $t_log = 0;
|
||||
|
||||
# Server port
|
||||
my $t_port = 41121;
|
||||
|
||||
# Do not output error messages, 1 enabled, 0 disabled
|
||||
my $t_quiet = 0;
|
||||
|
||||
# Server password
|
||||
my $t_pwd = '';
|
||||
|
||||
# Receive mode, 1 enabled, 0 disabled
|
||||
my $t_recv = 0;
|
||||
|
||||
# Retries for socket read/write operations
|
||||
my $t_retries = 3;
|
||||
|
||||
# Select handler
|
||||
my $t_select;
|
||||
|
||||
# Server socket
|
||||
my $t_socket;
|
||||
|
||||
# Use SSL, 1 true, 0 false
|
||||
my $t_ssl = 0;
|
||||
|
||||
# SSL ca certificate file
|
||||
my $t_ssl_ca = '';
|
||||
|
||||
# SSL certificate file
|
||||
my $t_ssl_cert = '';
|
||||
|
||||
# SSL private key file
|
||||
my $t_ssl_key = '';
|
||||
|
||||
# SSL private key file password
|
||||
my $t_ssl_pwd = '';
|
||||
|
||||
# Timeout for socket read/write operations in seconds
|
||||
my $t_timeout = 1;
|
||||
|
||||
################################################################################
|
||||
## SUB print_help
|
||||
## Print help screen.
|
||||
################################################################################
|
||||
sub print_help {
|
||||
|
||||
print ("Usage: $0 [options] [file] [file] ...\n\n");
|
||||
print ("Tentacle client v$VERSION. See http://www.openideas.info/wiki for protocol description.\n\n");
|
||||
print ("Options:\n");
|
||||
print ("\t-a address\tServer address (default $t_address).\n");
|
||||
print ("\t-c\t\tEnable SSL without a client certificate.\n");
|
||||
print ("\t-e cert\t\tOpenSSL certificate file. Enables SSL.\n");
|
||||
print ("\t-f ca\t\tVerify that the peer certificate is signed by a ca.\n");
|
||||
print ("\t-g\t\tGet files from the server.\n");
|
||||
print ("\t-h\t\tShow help.\n");
|
||||
print ("\t-k key\t\tOpenSSL private key file.\n");
|
||||
print ("\t-p port\t\tServer port (default $t_port).\n");
|
||||
print ("\t-q\t\tQuiet. Do now print error messages.\n");
|
||||
print ("\t-r number\tNumber of retries for network operations (default $t_retries).\n");
|
||||
print ("\t-t time\t\tTime-out for network operations in seconds (default ${t_timeout}s).\n");
|
||||
print ("\t-v\t\tBe verbose.\n");
|
||||
print ("\t-w\t\tPrompt for OpenSSL private key password.\n");
|
||||
print ("\t-x pwd\t\tServer password.\n\n");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB parse_options
|
||||
## Parse command line options and initialize global variables.
|
||||
################################################################################
|
||||
sub parse_options {
|
||||
my %opts;
|
||||
my $tmp;
|
||||
|
||||
# Get options
|
||||
if (getopts ('a:ce:f:ghk:p:qr:t:vwx:', \%opts) == 0 || defined ($opts{'h'})) {
|
||||
print_help ();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Address
|
||||
if (defined ($opts{'a'})) {
|
||||
$t_address = $opts{'a'};
|
||||
if ($t_address !~ /^[a-zA-Z\.]+$/ && ($t_address !~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
|
||||
|| $1 < 0 || $1 > 255 || $2 < 0 || $2 > 255
|
||||
|| $3 < 0 || $3 > 255 || $4 < 0 || $4 > 255)) {
|
||||
error ("Address $t_address is not valid.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Enable SSL without a client certificate
|
||||
if (defined ($opts{'c'})) {
|
||||
require IO::Socket::SSL;
|
||||
$t_ssl = 1;
|
||||
}
|
||||
|
||||
# Enable SSL
|
||||
if (defined ($opts{'e'})) {
|
||||
|
||||
if (defined ($opts{'c'})) {
|
||||
error ("Flags -c and -e can not be used at the same time.");
|
||||
}
|
||||
|
||||
require IO::Socket::SSL;
|
||||
|
||||
$t_ssl_cert = $opts{'e'};
|
||||
if (! -f $t_ssl_cert) {
|
||||
error ("File $t_ssl_cert does not exist.");
|
||||
}
|
||||
|
||||
$t_ssl = 1;
|
||||
}
|
||||
|
||||
# Verify peer certificate
|
||||
if (defined ($opts{'f'})) {
|
||||
|
||||
if (! defined ($opts{'e'})) {
|
||||
error ("Flag -e must be set to enable peer certificate verify.");
|
||||
}
|
||||
|
||||
$t_ssl_ca = $opts{'f'};
|
||||
if (! -f $t_ssl_ca) {
|
||||
error ("File $t_ssl_ca does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Get files
|
||||
if (defined ($opts{'g'})) {
|
||||
$t_recv = 1;
|
||||
}
|
||||
|
||||
# SSL private key file
|
||||
if (defined ($opts{'k'})) {
|
||||
|
||||
if (! defined ($opts{'e'})) {
|
||||
error ("Flag -e must be set to use a private key file.");
|
||||
}
|
||||
|
||||
$t_ssl_key = $opts{'k'};
|
||||
if (! -f $t_ssl_key) {
|
||||
error ("File $t_ssl_key does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Port
|
||||
if (defined ($opts{'p'})) {
|
||||
$t_port = $opts{'p'};
|
||||
if ($t_port !~ /^\d+$/ || $t_port < 1 || $t_port > 65535) {
|
||||
error ("Port $t_port is not valid.");
|
||||
}
|
||||
}
|
||||
|
||||
# Quiet mode
|
||||
if (defined ($opts{'q'})) {
|
||||
$t_quiet = 1;
|
||||
}
|
||||
|
||||
# Retries
|
||||
if (defined ($opts{'r'})) {
|
||||
$t_retries = $opts{'r'};
|
||||
if ($t_retries !~ /^\d+$/ || $t_retries < 1) {
|
||||
error ("Invalid number of retries for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Timeout
|
||||
if (defined ($opts{'t'})) {
|
||||
$t_timeout = $opts{'t'};
|
||||
if ($t_timeout !~ /^\d+$/ || $t_timeout < 1) {
|
||||
error ("Invalid timeout for network operations.");
|
||||
}
|
||||
}
|
||||
|
||||
# Be verbose
|
||||
if (defined ($opts{'v'})) {
|
||||
$t_log = 1;
|
||||
}
|
||||
|
||||
# SSL private key password
|
||||
if (defined ($opts{'w'})) {
|
||||
|
||||
if (! defined ($opts{'e'})) {
|
||||
error ("Flag -k must be set to provide a private key password.");
|
||||
}
|
||||
|
||||
$t_ssl_pwd = ask_passwd ("Enter private key file password: ", "Enter private key file password again for confirmation: ");
|
||||
}
|
||||
|
||||
# Server password
|
||||
if (defined ($opts{'x'})) {
|
||||
$t_pwd = $opts{'x'};
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB start_client
|
||||
## Open the server socket.
|
||||
################################################################################
|
||||
sub start_client {
|
||||
|
||||
# Connect to server
|
||||
$t_socket = IO::Socket::INET->new (
|
||||
PeerAddr => $t_address,
|
||||
PeerPort => $t_port,
|
||||
);
|
||||
|
||||
if (! defined ($t_socket)) {
|
||||
error ("Cannot connect to $t_address on port $t_port: $!.");
|
||||
}
|
||||
|
||||
# Add server socket to select queue
|
||||
$t_select = IO::Select->new ();
|
||||
$t_select->add ($t_socket);
|
||||
|
||||
print_log ("Connected to $t_address port $t_port");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB stop_client
|
||||
## Close the server socket.
|
||||
################################################################################
|
||||
sub stop_client {
|
||||
|
||||
$t_socket->close ();
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB start_ssl
|
||||
## Convert the server socket to an IO::Socket::SSL socket.
|
||||
################################################################################
|
||||
sub start_ssl {
|
||||
my $err;
|
||||
|
||||
if ($t_ssl_cert eq ''){
|
||||
IO::Socket::SSL->start_SSL (
|
||||
$t_socket,
|
||||
);
|
||||
}
|
||||
elsif ($t_ssl_ca eq '') {
|
||||
IO::Socket::SSL->start_SSL (
|
||||
$t_socket,
|
||||
SSL_cert_file => $t_ssl_cert,
|
||||
SSL_key_file => $t_ssl_key,
|
||||
SSL_passwd_cb => sub {return $t_ssl_pwd},
|
||||
SSL_use_cert =>'1',
|
||||
# No authentication
|
||||
SSL_verify_mode => '0x00',
|
||||
);
|
||||
}
|
||||
else {
|
||||
IO::Socket::SSL->start_SSL (
|
||||
$t_socket,
|
||||
SSL_ca_file => $t_ssl_ca,
|
||||
SSL_cert_file => $t_ssl_cert,
|
||||
SSL_key_file => $t_ssl_key,
|
||||
SSL_passwd_cb => sub {return $t_ssl_pwd},
|
||||
SSL_use_cert =>'1',
|
||||
# Verify peer
|
||||
SSL_verify_mode => '0x01',
|
||||
);
|
||||
}
|
||||
|
||||
$err = IO::Socket::SSL::errstr ();
|
||||
if ($err ne '') {
|
||||
error ($err);
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB auth_pwd
|
||||
## Authenticate client with server password.
|
||||
################################################################################
|
||||
sub auth_pwd {
|
||||
my $command;
|
||||
my $pwd_digest;
|
||||
|
||||
require Digest::MD5;
|
||||
|
||||
$pwd_digest = Digest::MD5::md5 ($t_pwd);
|
||||
$pwd_digest = Digest::MD5::md5_hex ($pwd_digest);
|
||||
|
||||
send_data ("PASS $pwd_digest\n");
|
||||
|
||||
$command = recv_command ($t_block_size);
|
||||
if ($command !~ /^PASS OK$/) {
|
||||
error ("Authentication failed.");
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_file
|
||||
## Receive a file from the server
|
||||
################################################################################
|
||||
sub recv_file {
|
||||
my $data = '';
|
||||
my $file = $_[0];
|
||||
my $response;
|
||||
my $size;
|
||||
|
||||
# Request file
|
||||
send_data ("RECV <$file>\n");
|
||||
|
||||
# Wait for server response
|
||||
$response = recv_command ();
|
||||
if ($response !~ /^RECV SIZE (\d+)$/) {
|
||||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
$size = $1;
|
||||
send_data ("RECV OK\n");
|
||||
|
||||
# Receive file
|
||||
$data = recv_data_block ($size);
|
||||
|
||||
# Write it to disk
|
||||
open (FILE, "> $file") || error ("Cannot open file '$file' for writing.");
|
||||
binmode (FILE);
|
||||
print (FILE $data);
|
||||
close (FILE);
|
||||
|
||||
print_log ("Received file '$file'");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB send_file
|
||||
## Send a file to the server
|
||||
################################################################################
|
||||
sub send_file {
|
||||
my $base_name;
|
||||
my $data = '';
|
||||
my $response = '';
|
||||
my $retries;
|
||||
my $file = $_[0];
|
||||
my $size;
|
||||
my $written;
|
||||
|
||||
$base_name = basename ($file);
|
||||
$size = -s $file;
|
||||
|
||||
# Request to send file
|
||||
send_data ("SEND <$base_name> SIZE $size\n");
|
||||
|
||||
print_log ("Request to send file '$base_name' size ${size}b");
|
||||
|
||||
# Wait for server response
|
||||
$response = recv_command ();
|
||||
|
||||
# Server rejected the file
|
||||
if ($response ne "SEND OK") {
|
||||
send_data ("QUIT\n");
|
||||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("Server responded SEND OK");
|
||||
|
||||
# Send the file
|
||||
open (FILE, $file) || error ("Cannot open file '$file' for reading.");
|
||||
binmode (FILE);
|
||||
|
||||
while ($data = <FILE>) {
|
||||
send_data ($data);
|
||||
}
|
||||
|
||||
close (FILE);
|
||||
|
||||
# Wait for server response
|
||||
$response = recv_command ();
|
||||
if ($response ne "SEND OK") {
|
||||
send_data ("QUIT\n");
|
||||
error ("Server responded $response.");
|
||||
}
|
||||
|
||||
print_log ("File sent");
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Common functions
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
## SUB print_log
|
||||
## Print log messages.
|
||||
################################################################################
|
||||
sub print_log {
|
||||
|
||||
if ($t_log == 1) {
|
||||
print (STDOUT "[log] $_[0]\n");
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB error
|
||||
## Print an error and exit the program.
|
||||
################################################################################
|
||||
sub error {
|
||||
|
||||
if ($t_quiet == 0) {
|
||||
print (STDERR "[err] $_[0]\n");
|
||||
}
|
||||
|
||||
exit 1;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_data
|
||||
## Read data from the client socket. Returns the number of bytes read and the
|
||||
## string of bytes as a two element array.
|
||||
################################################################################
|
||||
sub recv_data {
|
||||
my $data;
|
||||
my $read;
|
||||
my $retries = 0;
|
||||
my $size = $_[0];
|
||||
|
||||
while (1) {
|
||||
|
||||
# Try to read data from the socket
|
||||
if ($t_select->can_read ($t_timeout)) {
|
||||
|
||||
# Read at most $size bytes
|
||||
$read = sysread ($t_socket, $data, $size);
|
||||
|
||||
# Read error
|
||||
if (! defined ($read)) {
|
||||
error ("Read error from " . $t_socket->sockhost () . ": $!.");
|
||||
}
|
||||
|
||||
# EOF
|
||||
if ($read == 0) {
|
||||
error ("Connection from " . $t_socket->sockhost () . " unexpectedly closed.");
|
||||
}
|
||||
|
||||
return ($read, $data);
|
||||
}
|
||||
|
||||
# Retry
|
||||
$retries++;
|
||||
|
||||
# But check for error conditions first
|
||||
if ($retries > $t_retries) {
|
||||
error ("Connection from " . $t_socket->sockhost () . " timed out.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB send_data
|
||||
## Write data to the client socket.
|
||||
################################################################################
|
||||
sub send_data {
|
||||
my $data = $_[0];
|
||||
my $retries = 0;
|
||||
my $size;
|
||||
my $total = 0;
|
||||
my $written;
|
||||
|
||||
$size = length ($data);
|
||||
|
||||
while (1) {
|
||||
|
||||
# Try to write data to the socket
|
||||
if ($t_select->can_write ($t_timeout)) {
|
||||
|
||||
$written = syswrite ($t_socket, $data, $size - $total, $total);
|
||||
|
||||
# Read error
|
||||
if (! defined ($written)) {
|
||||
error ("Connection error from " . $t_socket->sockhost () . ": $!.");
|
||||
}
|
||||
|
||||
# EOF
|
||||
if ($written == 0) {
|
||||
error ("Connection from " . $t_socket->sockhost () . " unexpectedly closed.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$total += $written;
|
||||
|
||||
# All data was written
|
||||
if ($total == $size) {
|
||||
return;
|
||||
}
|
||||
|
||||
# Retry
|
||||
$retries++;
|
||||
|
||||
# But check for error conditions first
|
||||
if ($retries > $t_retries) {
|
||||
error ("Connection from " . $t_socket->sockhost () . " timed out.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_command
|
||||
## Read a command from the client, ended by a new line character.
|
||||
################################################################################
|
||||
sub recv_command {
|
||||
my $buffer;
|
||||
my $char;
|
||||
my $command = '';
|
||||
my $read;
|
||||
my $total = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
($read, $buffer) = recv_data ($t_block_size);
|
||||
$command .= $buffer;
|
||||
$total += $read;
|
||||
|
||||
# Check if the command is complete
|
||||
$char = chop ($command);
|
||||
if ($char eq "\n") {
|
||||
return $command;
|
||||
}
|
||||
|
||||
$command .= $char;
|
||||
|
||||
# Avoid overflow
|
||||
if ($total > $t_block_size) {
|
||||
error ("Received too much data from " . $t_socket->sockhost ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB recv_data_block
|
||||
## Read $_[0] bytes of data from the client.
|
||||
################################################################################
|
||||
sub recv_data_block {
|
||||
my $buffer = '';
|
||||
my $data = '';
|
||||
my $read;
|
||||
my $size = $_[0];
|
||||
my $total = 0;
|
||||
|
||||
while (1) {
|
||||
|
||||
($read, $buffer) = recv_data ($size - $total);
|
||||
$data .= $buffer;
|
||||
$total += $read;
|
||||
|
||||
# Check if all data has been read
|
||||
if ($total == $size) {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
## SUB ask_passwd
|
||||
## Asks the user for a password.
|
||||
################################################################################
|
||||
sub ask_passwd {
|
||||
my $msg1 = $_[0];
|
||||
my $msg2 = $_[1];
|
||||
my $pwd1;
|
||||
my $pwd2;
|
||||
|
||||
require Term::ReadKey;
|
||||
|
||||
# Disable keyboard echo
|
||||
Term::ReadKey::ReadMode('noecho');
|
||||
|
||||
# Promt for password
|
||||
print ($msg1);
|
||||
$pwd1 = Term::ReadKey::ReadLine(0);
|
||||
print ("\n$msg2");
|
||||
$pwd2 = Term::ReadKey::ReadLine(0);
|
||||
print ("\n");
|
||||
|
||||
# Restore original settings
|
||||
Term::ReadKey::ReadMode('restore');
|
||||
|
||||
if ($pwd1 ne $pwd2) {
|
||||
# Call print to bypass quiet mode.
|
||||
print ("[err] Passwords do not match.\n");
|
||||
exit 1;
|
||||
}
|
||||
|
||||
# Remove the trailing new line character
|
||||
chop $pwd1;
|
||||
|
||||
return $pwd1;
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main
|
||||
################################################################################
|
||||
|
||||
my $file;
|
||||
|
||||
# Parse command line options
|
||||
parse_options ();
|
||||
|
||||
# Check command line arguments
|
||||
if ($t_recv == 0 && $#ARGV == -1) {
|
||||
error ("No files to send.");
|
||||
}
|
||||
|
||||
# Connect to the server
|
||||
start_client ();
|
||||
|
||||
# Start SSL
|
||||
if ($t_ssl == 1) {
|
||||
start_ssl ();
|
||||
}
|
||||
|
||||
# Authenticate with server
|
||||
if ($t_pwd ne '') {
|
||||
auth_pwd ();
|
||||
}
|
||||
|
||||
if ($t_recv == 0) {
|
||||
# Check that all files exist before trying to send them
|
||||
foreach $file (@ARGV) {
|
||||
if (! -f $file) {
|
||||
error ("File '$file' does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
# Send the files
|
||||
foreach $file (@ARGV) {
|
||||
send_file ($file);
|
||||
}
|
||||
}
|
||||
else {
|
||||
# Send the files
|
||||
foreach $file (@ARGV) {
|
||||
recv_file ($file);
|
||||
}
|
||||
}
|
||||
|
||||
# Tell the server that we are finished
|
||||
send_data ("QUIT\n");
|
||||
|
||||
stop_client ();
|
||||
|
||||
exit 0;
|
Loading…
Reference in New Issue