2008-07-07 Evi Vanoost <vanooste@rcbi.rochester.edu>

* pandora_agents/tools
           pandora_agents/linux/plugins
           pandora_agents/mac_osx/plugins: Moved tools into the plugin sections of compatible agents. The plugins in subdirectories have dependencies that can be found in the README file while plugins directly in the directory can be used directly when Pandora agent prerequisites are met (Perl & Bash)

        * pandora_agents/mac_osx/pandora_user.conf
           pandora_agents/mac_osx/plugins/ppc_sensors: Moved pandora_user.conf into the new plugins section

        * pandora_server/pandora_server_installer: Refined the installer so that it doesn't try installing certain parts on systems (usually non-Linux) that don't support cronjobs or /etc/init.d startup. It will just fail with a message for now. Also updated the error messages that appear so that they are more clear (eg. what Perl modules and how to use cpan).

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@940 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2008-07-08 18:52:57 +00:00
parent 938d060b0d
commit 953a38a52d
19 changed files with 561 additions and 108 deletions

View File

@ -18,7 +18,7 @@ interval 300
# Debug mode only generate XML, and stop after first execution,
# and does not copy XML to server.
debug 1
debug 0
# By default, agent takes machine name
#agent_name adama
@ -31,7 +31,7 @@ debug 1
server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
transfer_mode local
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword
@ -57,12 +57,13 @@ transfer_mode tentacle
# cron_mode
# If set to 1 allows the agent to be configured via the web console.
# remote_config 0
remote_config 1
# Module Definition
# =================
# System information for clients
# System information
module_begin
module_name CPU (User)
@ -92,17 +93,35 @@ 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_end
module_begin
module_name Physical Memory (Total)
module_type generic_data
module_exec sysctl -n hw.memsize
module_description Used Physical Memory
module_exec sysctl -n hw.physmem
module_description Total Physical Memory
module_end
module_begin
module_name Physical Memory (Used)
module_type generic_data
module_exec top -l 1 | grep PhysMem | awk '{gsub("M","",$8)} {print $8}'
module_exec sysctl -n hw.usermem
module_description Used Physical Memory
module_end
@ -113,40 +132,6 @@ module_exec ps -A | wc -l
module_description Total Number of Processes
module_end
# Hardware information
module_begin
module_name CPUs (Number)
module_type generic_data
module_exec sysctl -n hw.ncpu
module_max 8
module_min 1
module_description Number of Processors
module_end
module_begin
module_name Architecture
module_type generic_data_string
module_exec arch
module_description Architecture
module_end
# Informational stuff
module_begin
module_name Syslog (Last string)
module_type generic_data_string
module_exec tail -1 /var/log/system.log
module_description Last line of syslog
module_end
module_begin
module_name Login (Last)
module_type generic_data_string
module_exec last | head -1
module_description Last connected to system
module_end
# Networking
module_begin
@ -170,6 +155,13 @@ module_exec netstat -as | grep "bad reset" | awk '{ print $1 }'
module_description Bad Resets
module_end
module_begin
module_name Network Adapter bond0 IPv4 Address
module_type generic_data_string
module_exec ifconfig bond0 | grep "inet " | awk '{ print $2 }'
module_description IP Address Interface 1
module_end
module_begin
module_name Network Adapter en0 Status
module_type generic_proc
@ -177,21 +169,24 @@ module_exec ifconfig en0 | grep status | awk '{ if($6=="active") { print 1}; if(
module_description Ethernet Link 0
module_end
# You should have alerts in case the number of rules change
module_begin
module_name Network Adapter en1 Status
module_type generic_proc
module_exec ifconfig en1 | grep status | awk '{ if($6=="active") { print 1}; if($6!="active") {print 0}}'
module_description Ethernet Link 1
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 Network Adapter bond0 Status
module_type generic_proc
module_exec ifconfig bond0 | grep status | awk '{ if($6=="active") { print 1}; if($6!="active") {print 0}}'
module_description Ethernet Bond 0
module_end
#######################################################################
# #
# The following is for use if you have services (or a server) running #
# This works for most services both in Leopard and Tiger #
# #
#######################################################################
# ========================
# Services
# =======================
## Uncomment/Comment as you go
@ -223,12 +218,22 @@ module_end
#module_description DHCP & BOOTP server
#module_end
#module_begin
#module_name DNS
#module_type generic_proc
#module_exec ps auxw | grep "sbin\/named" | wc -l
#module_description DNS Server
#module_end
module_begin
module_name DNS
module_type generic_proc
module_exec ps aux | grep "sbin\/named" | wc -l
module_description DNS Server
module_end
# Firewall always has 1 rule (allow) so we substract one.
# You should have alerts in case the number of rules change
module_begin
module_name Firewall Status
module_type generic_data
module_exec echo `sudo ipfw show | wc -l` - 1 | bc
module_description Firewall (number of rules)
module_end
#module_begin
#module_name FTP
@ -247,14 +252,14 @@ module_end
#module_begin
#module_name Mail (SMTP)
#module_type generic_proc
#module_exec ps -axu | grep "postfix" | grep -v "grep" | wc -l
#module_exec ps -A | grep "master" | grep -v "grep" | wc -l
#module_description Mail - SMTP Server (postfix)
#module_end
#module_begin
#module_name Mail (IMAP)
#module_type generic_proc
#module_exec ps -axu | grep "master" | grep "cyrus" | grep -v "grep" | wc -l
#module_exec ps -A | grep "cyrus" | grep -v "grep" | wc -l
#module_description Mail - IMAP Server (cyrus)
#module_end
@ -279,6 +284,7 @@ module_end
#module_description Mail - Mailing Lists (mailman)
#module_end
#module_begin
#module_name NAT
#module_type generic_proc
@ -287,19 +293,26 @@ module_end
#module_end
#module_begin
#module_name NFS
#module_name NetBoot
#module_type generic_proc
#module_exec ps auxw | grep "nfsd-master" | grep -v "grep" | wc -l
#module_description NFS File Server
#module_exec echo 0
#module_description NetBoot
#module_end
#module_begin
#module_name Open Directory
#module_name NFS
#module_type generic_proc
#module_exec ps auxw | grep "krb5kdc" | grep -v "grep" | wc -l
#module_description Open Directory
#module_exec ps aux | grep "nfsd-master" | grep -v "grep" | wc -l
#module_description NFS File Server
#module_end
module_begin
module_name Open Directory
module_type generic_proc
module_exec ps aux | grep "bin\/krb5kdc" | wc -l
module_description Open Directory
module_end
#module_begin
#module_name Print
#module_type generic_proc
@ -314,12 +327,12 @@ module_end
#module_description QT Streaming Service
#module_end
#module_begin
#module_name Software Update
#module_type generic_proc
#module_exec if [ `ps -A | grep "etc\/swupd" | wc -l` -gt "1" ]; then echo 1; else echo 0; fi
#module_description Software Update
#module_end
module_begin
module_name Software Update
module_type generic_proc
module_exec if [ `ps -A | grep "etc\/swupd" | wc -l` -gt "1" ]; then echo 1; else echo 0; fi
module_description Software Update
module_end
#module_begin
#module_name VPN
@ -356,5 +369,5 @@ module_end
#module_description XGrid
#module_end
# Plugin example (new in Pandora 2.0)
module_plugin grep_log /var/log/syslog Syslog ssh
# Plugin Section #
module_plugin ppc_sensors

View File

@ -0,0 +1,9 @@
Pandora XServe RAID agent configuration
This only contains the files and tools required to monitor the status of an XServe RAID. It uses a package I found on alienRAID for this purpose.
The monitoring packages (xserve-raid-tools-1.2.*) also include Nagios plugins.
The pandora_agent.conf has all the configuration modules for each part of an XServe RAID (every single drive module can be monitored).
For the agent itself, you'll have to use or clone a Mac, Unix or Linux client and overwrite the configuration with this one. I tested this and it's running on Mac OS X 10.4 and 10.5 in my environment.

View File

@ -0,0 +1,3 @@
#!/bin/sh
/usr/local/bin/check_xserve_raid --address 0.0.0.0 --debug --debug > /private/var/root/xserve-status
cat /private/var/root/xserve-status | grep "lhs.array1 optimal, rhs.array1 optimal" | wc -l

View File

@ -0,0 +1,239 @@
# Base config file for Pandora FMS agents
# Version 1.2
# Licensed under GPL license v2,
# (c) 2003-2007 Sancho Lerena and others.
# please visit http://pandora.sourceforge.net
# General Parameters
# ==================
server_ip skull
server_path /var/spool/pandora/data_in
temporal /var/spool/pandora-xserve/data_out
logfile /var/log/pandora/pandora_agent-xserve.log
# Interval in seconds, 300 by default
interval 300
# Debug mode only generate XML, and stop after first execution,
# and does not copy XML to server.
debug 0
# By default is activated
checksum 0
# By default, agent takes machine name
agent_name XServe-RAID-1
# By default agent try to take default encoding defined in host.
# encoding iso-8859-15
# By default is 22 (for ssh)
#server_port 22
# ftp, ssh or local
transfer_mode ssh
# delayed_startup defines number of MINUTES before start execution
# for first time when startup Pandora Agent
#delayed_startup 90
#Pandora nice defines priority of execution. Less priority means more intensive execution
#A recommended value is 10. 0 priority means no Pandora CPU protection enabled
#pandora_nice 0
# Module Definition
# =================
# System information
module_begin
module_name XServe Health
module_type generic_proc
module_exec /rcbiUsers/pandora/check_xserve
module_end
module_begin
module_name Left Array RAID Status
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.array1 raid-status is" | awk '{ if ($8=="online"){ print 1 }; if ($8!="online") {print 0};}'
module_descripcion Left hand (Top) Array RAID Status
module_end
module_begin
module_name Right Array RAID Status
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.array1 raid-status is" | awk '{ if ($8=="online"){ print 1 }; if ($8!="online") {print 0};}'
module_descripcion Right hand (Bottom) Array RAID Status
module_end
module_begin
module_name Left Array Sector Capacity
module_type generic_data_inc
module_exec cat /private/var/root/xserve-status | grep "lhs.array1 sector-capacity is" | awk '{ print $8}'
module_descripcion Left hand (Top) Array Sector Capacity
module_end
module_begin
module_name Right Array Sector Capacity
module_type generic_data_inc
module_exec cat /private/var/root/xserve-status | grep "rhs.array1 sector-capacity is" | awk '{ print $8}'
module_descripcion Right hand (Bottom) Array Sector Capacity
module_end
module_begin
module_name Left Array UPS Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 --max-count=1 "ups-warning" | grep "<false/>" | wc -l
module_descripcion Left hand (Top) Array UPS Warning
module_end
module_begin
module_name Right Array UPS Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 "ups-warning" | grep -A 2 "\-\-" | grep "<false/>" | wc -l
module_descripcion Right hand (Bottom) Array UPS Warning
module_end
module_begin
module_name Left Array Battery Status
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 --max-count=1 "battery-status" | grep "present" | wc -l
module_descripcion Left hand (Top) Array Battery Status
module_end
module_begin
module_name Right Array Battery Status
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 "battery-status" | grep -A 2 "\-\-" | grep "present" | wc -l
module_descripcion Right hand (Bottom) Array Battery Status
module_end
module_begin
module_name Left Array Fan Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 --max-count=1 "fan-warning" | grep "<false/>" | wc -l
module_descripcion Left hand (Top) Array Fan Warning
module_end
module_begin
module_name Right Array Fan Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 "fan-warning" | grep -A 2 "\-\-" | grep "<false/>" | wc -l
module_descripcion Right hand (Bottom) Array Fan Warning
module_end
module_begin
module_name Left Array Power Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 --max-count=1 "power-warning" | grep "<false/>" | wc -l
module_descripcion Left hand (Top) Array Power Warning
module_end
module_begin
module_name Right Array Power Warning
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep -A 1 "power-warning" | grep -A 2 "\-\-" | grep "<false/>" | wc -l
module_descripcion Right hand (Bottom) Array Power Warning
module_end
module_begin
module_name Left Array Slot 1
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot1 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 1 Status
module_end
module_begin
module_name Left Array Slot 2
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot2 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 2 Status
module_end
module_begin
module_name Left Array Slot 3
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot3 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 3 Status
module_end
module_begin
module_name Left Array Slot 4
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot4 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 4 Status
module_end
module_begin
module_name Left Array Slot 5
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot5 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 5 Status
module_end
module_begin
module_name Left Array Slot 6
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot6 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 6 Status
module_end
module_begin
module_name Left Array Slot 7
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "lhs.slot7 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Left hand (Top) Array Slot 7 Status
module_end
module_begin
module_name Right Array Slot 1
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot1 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 1 Status
module_end
module_begin
module_name Right Array Slot 2
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot2 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 2 Status
module_end
module_begin
module_name Right Array Slot 3
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot3 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 3 Status
module_end
module_begin
module_name Right Array Slot 4
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot4 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 4 Status
module_end
module_begin
module_name Right Array Slot 5
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot5 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 5 Status
module_end
module_begin
module_name Right Array Slot 6
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot6 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 6 Status
module_end
module_begin
module_name Right Array Slot 7
module_type generic_proc
module_exec cat /private/var/root/xserve-status | grep "rhs.slot7 is" | awk '{ if ($7$8=="notrebuilding"){ print 1 }; if ($7$8!="notrebuilding") {print 0};}'
module_descripcion Right hand (Bottom) Array Slot 7 Status
module_end

View File

@ -0,0 +1,8 @@
This is a simple script that could be called from within pandora_user.conf
It will call an IPMI-capable host (IP-address) and acquire it's sensors, then parse them into an understandable XML file for Pandora FMS.
Make sure you set up a the correct name for the agent configuration if the monitoring is done from another host than the one the IPMI chip is located at.
This script might not work and has only been tested so far against an Intel-based Apple XServe but the script is built up so it should acquire any.
ipmitool and php (tested 5, 4 should work too) is required on the machine the agent is running on.

View File

@ -0,0 +1,147 @@
#!/usr/bin/php
<?php
$host = "128.151.188.89";
$user = "pandora";
$pass = "";
$path = "ipmitool";
$opt['chassis'] = "chassis status";
$opt['sensor'] = "sensor";
$cmd['chassis'] = $path . " -H " . $host . " -U " . $user . " -P " . $pass . " " . $opt['chassis'];
$cmd['sensor'] = $path . " -H " . $host . " -U " . $user . " -P " . $pass . " " . $opt['sensor'];
//print_r($cmd);
$output['chassis'] = shell_exec($cmd['chassis']);
$output['sensor'] = shell_exec($cmd['sensor']);
//Chassis
/* Sample output
System Power : on
Power Overload : false
Power Interlock : inactive
Main Power Fault : false
Power Control Fault : false
Power Restore Policy : always-on
Last Power Event :
Chassis Intrusion : inactive
Front-Panel Lockout : active
Drive Fault : false
Cooling/Fan Fault : false
Front Panel Light : off
*/
/* Sample XML
<module><data>28.5</data><name>DRIVE BAY</name><type>generic_data</type></module>
*/
$array = explode("\n",$output['chassis']);
foreach ($array as $value) {
if($value != "") {
$tmp = explode(":",$value);
$status[trim($tmp[0])] = trim($tmp[1]);
}
}
unset($array);
unset($tmp);
foreach ($status as $name => $data) {
switch($name) {
case "Power Interlock":
case "Last Power Event":
case "System Power":
case "Power Restore Policy":
break;
case "Power Overload":
case "Main Power Fault":
case "Power Control Fault":
case "Drive Fault":
case "Cooling/Fan Fault":
$data_out = ($data="false" ? "1" : "0");
case "Front Panel Light":
$data_out = ($data="off" ? "1" : "0");
echo "<module><name>" . $name . "</name><data>" . $data_out . "</data><type>generic_proc</type></module>";
}
}
unset($status);
//End of Chassis
//Begin of Sensor
$array = explode("\n\n",$output['sensor']);
foreach ($array as $value) {
if($value != "") {
$tmp[] = explode("\n",$value);
}
}
foreach ($tmp as $value_arr) {
foreach ($value_arr as $value) {
if($value != "") {
$tmp2 = explode(":",$value);
$status[trim($tmp2[0])] = trim($tmp2[1]);
}
}
unset($value_arr);
unset($tmp2);
/* Sample $status array
[Sensor ID] => 'PSU1 Fan Out' (0x3c)
[Entity ID] => 10.1
[Sensor Type (Analog)] => Fan
[Sensor Reading] => 6784 (+/- 0) RPM
[Status] => ok
[Lower Non-Recoverable] => na
[Lower Critical] => na
[Lower Non-Critical] => 1024.000
[Upper Non-Critical] => 18048.000
[Upper Critical] => na
[Upper Non-Recoverable] => na
[Assertion Events] =>
[Assertions Enabled] => lnc- lnc+ unc- unc+
[Deassertions Enabled] => lnc- lnc+ unc- unc+
*/
//Get the name without references
$name_tmp = explode("'",$status["Sensor ID"]);
/* //Get the Sensor Type
if(array_key_exists("Sensor Type (Analog)",$status)) {
$status["type"] = $status["Sensor Type (Analog)"];
} elseif(array_key_exists("Sensor Type (Discrete)",$status)) {
$status["type"] = $status["Sensor Type (Discrete)"];
} else {
echo "Unhandled Sensor Type";
print_r($status);
die();
}
*/
$data_tmp = explode(" ",$status["Sensor Reading"]);
if($data_tmp[3]) {
$name = $name_tmp[1] . " (" . $data_tmp[3] . ($data_tmp[4] ? " " . $data_tmp[4] : "" ) . ")";
echo "\n<module><name>" . $name . "</name>";
if($status["Lower Non-Critical"] != "na") {
$min = "<min>" . $status["Lower Non-Critical"] . "</min>";
}
if($status["Upper Non-Critical"] != "na") {
$max = "<max>" . $status["Upper Non-Critical"] . "</max>";
}
if($status["Lower Critical"] != "na") {
$min = "<min>" . $status["Lower Critical"] . "</min>";
}
if($status["Upper Critical"] != "na") {
$max = "<max>" . $status["Upper Critical"] . "</max>";
}
echo $min . $max . "<data>" . $data_tmp[0] . "</data><type>generic_data</type></module>";
}
//$data_out = ($data="false" ? "1" : "0");
//$data_out = ($data="off" ? "1" : "0");
unset($status);
}
//End of Sensor
?>

View File

@ -28,23 +28,42 @@ then
echo " "
echo " $ yum perl-XML-SAX* perl-Tie* perl-XML-Simple* perl-DateManip* perl-IO-Socket* perl-Time-modules* perl-NetAddr-IP* perl-GD* perl-DateTime* perl-ExtUtils"
echo " "
echo " $ cpan install Digest::MD5 Time::Local DBI threads threads::shared IO::Socket Time::HiRes Time::Format Net::Ping NetAddr::IP "
echo "To get it from source through CPAN do"
echo " "
echo " $ cpan Digest::MD5 Time::Local DBI threads threads::shared IO::Socket Time::HiRes Time::Format Net::Ping NetAddr::IP Mail::Sendmail Net::Traceroute::PurePerl"
echo " "
rm output
else
make
make install
mkdir /var/spool/pandora
mkdir /var/spool/pandora/data_in
id pandora
if [ $? -eq 0 ]; then
echo " "
echo "User pandora does exist, make sure the SSH directories are correct"
else
useradd pandora
mkdir /home/pandora
mkdir /home/pandora/.ssh
chown -R pandora /home/pandora
fi
mkdir /var/log/pandora
chown pandora:root /var/spool/pandora/data_in
chown pandora:wheel /var/spool/pandora/data_in
chmod 770 /var/spool/pandora/data_in
mkdir /etc/pandora
if [ -e /etc/pandora/pandora_server.conf ]; then
echo "Old installation detected, backing up pandora_server.conf"
mv /etc/pandora/pandora_server.conf /etc/pandora/pandora_server.conf.bak
fi
cp conf/pandora_server.conf /etc/pandora/
chmod 770 /etc/pandora/pandora_server.conf
if [ "`uname -s`" != "Linux" ]; then
echo "This is not a Linux-based distro. The installer will not create files for automatic startup."
echo "Copying the binaries into /usr/local/bin"
cp pandora_* /usr/local/bin
rm /usr/local/bin/pandora_server_installer
else
cp pandora_* /etc/init.d/
rm /etc/init.d/pandora_server_installer
ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server
@ -53,6 +72,7 @@ else
ln -s /etc/init.d/pandora_snmpconsole /etc/rc2.d/S90pandora_snmpconsole
ln -s /etc/init.d/pandora_plugin /etc/rc2.d/S90pandora_plugin
ln -s /etc/init.d/pandora_prediction /etc/rc2.d/S90pandora_prediction
fi
if [ -e /usr/local/bin/pandora_server ]
then
@ -74,18 +94,32 @@ else
mkdir /usr/share/pandora
cp -R util /usr/share/pandora
cp -R plugin /usr/share/pandora
if [ -d /etc/cron.daily ]
then
echo "perl /usr/share/pandora/util/pandora_db /etc/pandora/pandora_server.conf" > /etc/cron.daily/pandora_purge_db
chmod +x /etc/cron.daily/pandora_purge_db
else
echo "You're probably not using cron for automatic scheduling. You should schedule the following command to run frequently (daily) on your master server:"
echo " perl /usr/share/pandora/util/pandora_db /etc/pandora/pandora_server.conf"
fi
rm output
fi
}
uninstall () {
if [ "`uname -s`" != "Linux" ]; then
echo "This is not a Linux-based distro. Uninstaller is currently not working for your OS"
fi
echo "Removing Pandora Servers"
rm -Rf /var/spool/pandora/data_in/
rm -Rf /home/pandora/
userdel pandora
echo "If the user Pandora is not being used for any other operations, please delete using the following commands:"
echo " userdel pandora"
echo " rm -Rf /home/pandora/"
## Just to clarify here. Some people (like me) are using the pandora user for other purposes and/or using an LDAP-based user management
## I would hate to have a script clear out this users' information without any notification
rm -Rf /var/log/pandora/
rm -Rf /etc/pandora/pandora_server.conf
rm -Rf /etc/init.d/pandora_server