2009-09-18 sancho Lerena <slerena@artica.es>

* unix: Added subdir with local daemon script and sample conf
        file for each supported system: Linux, AIX, Solaris and HPUX.

        * Installer now detects OS and install startup scripts and
        conf depending on OS.

        * Updated RPM spec for Linux agent.

        * Plugins: Let here (at this time) only "common" plugins,
        in the future will be common plugins and OS dependendant 
        plugins.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1959 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
slerena 2009-09-18 18:45:44 +00:00
parent 0ac6724734
commit e9da8865d5
26 changed files with 754 additions and 798 deletions

View File

@ -1,3 +1,17 @@
2009-09-18 sancho Lerena <slerena@artica.es>
* unix: Added subdir with local daemon script and sample conf
file for each supported system: Linux, AIX, Solaris and HPUX.
* Installer now detects OS and install startup scripts and
conf depending on OS.
* Updated RPM spec for Linux agent.
* Plugins: Let here (at this time) only "common" plugins,
in the future will be common plugins and OS dependendant
plugins.
2009-09-14 Ramon Novoa <rnovoa@artica.es>
* unix, unix/pandora_agent_installer,

View File

@ -1 +0,0 @@
This script can be used as a plugin in Pandora FMS. It will return an XML with the current status of an SGE cluster

View File

@ -1,89 +0,0 @@
#!/bin/bash
###############################################################################
#
# Copyright (c) 2008 Evi Vanoost <vanooste@rcbi.rochester.edu>
#
# SGEStatus: A quick shell script that can be used as a Pandora plugin to
# display the SGE cluster status
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
###############################################################################
SGE_BIN="/RCBI/sge/bin/darwin-ppc"
PENDING=$[`$SGE_BIN/qstat -s p | grep " qw " | wc -l`+0]
RUNNING=$[`$SGE_BIN/qstat -s a | grep " r " | wc -l`+0]
HOSTS=$[`qhost | wc -l`-3]
QUEUES=`qstat -g c | grep -v '\-\-\-' | grep -v "CLUSTER QUEUE" | awk '{print $1}'`
NUMQUEUE=0
echo "<module>
<name>Pending Jobs (Cluster)</name>
<data>$PENDING</data>
<type>generic_data</type></module>
<module>
<name>Running Jobs (Cluster)</name>
<data>$RUNNING</data>
<type>generic_data</type></module>
<module>
<name>Number of Hosts (Cluster)</name>
<data>$HOSTS</data>
<type>generic_data</type></module>"
for queue in $QUEUES
do
NUMQUEUE=$[$NUMQUEUE+1]
# CLUSTER QUEUE CQLOAD USED AVAIL TOTAL aoACDS cdsuE
# 64bit 0.15 0 8 22 0 14
QINFO=`qstat -g c | grep $queue`
AVGLOAD=`echo $QINFO | awk '{print $2}'`
USEDSLOTS=`echo $QINFO | awk '{print $3}'`
AVAILSLOTS=`echo $QINFO | awk '{print $4}'`
TOTALSLOTS=`echo $QINFO | awk '{print $5}'`
ADMSTATUS=`echo $QINFO | awk '{print $6}'`
ERRSTATUS=`echo $QINFO | awk '{print $7}'`
echo "<module>
<name>Available Slots (Q: $queue)</name>
<data>$AVAILSLOTS</data>
<type>generic_data</type>
</module>
<module>
<name>Used Slots (Q: $queue)</name>
<data>$USEDSLOTS</data>
<type>generic_data</type>
</module>
<module>
<name>Total Slots (Q: $queue)</name>
<data>$TOTALSLOTS</data>
<type>generic_data</type>
</module>
<module>
<name>Average load (Q: $queue)</name>
<data>$AVGLOAD</data>
<type>generic_data</type>
</module>
<module>
<name>Slots in Status aoACDS (Q: $queue)</name>
<data>$ADMSTATUS</data>
<type>generic_data</type>
</module>
<module>
<name>Slots in Status cdsuE (Q: $queue)</name>
<data>$ERRSTATUS</data>
<type>generic_data</type>
</module>"
done
echo "<module>
<name>Number of Queues</name>
<data>$NUMQUEUE</data>
<type>generic_data</type></module>"

View File

@ -1,9 +0,0 @@
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

@ -1,3 +0,0 @@
#!/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

@ -1,239 +0,0 @@
# 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

@ -1,42 +0,0 @@
#!/bin/bash
# THIS PLUGIN needs netcat (nc) and have the status extension enabled in your Apache2.
# Also need to setup advanced status in your apache setup (ExtendedStatus On)
ASTAT="`echo -e 'GET /server-status?auto HTTP/1.0\n\n' | nc -w 10 localhost 80`"
AP_CPULOAD=`echo $ASTAT | grep -o "CPULoad: [0-9.]*" | awk '{ print $2}'`
AP_REQSEC=`echo $ASTAT | grep -o "ReqPerSec: [0-9.]*" | awk '{ print $2}'`
AP_TOTACC=`echo $ASTAT | grep -o "Total Accesses: [0-9]*" | awk '{ print $3}'`
AP_BUSY=`echo $ASTAT | grep -o "BusyWorkers: [0-9]*" | awk '{ print $2}'`
AP_BPS=`echo $ASTAT | grep -o "BytesPerSec: [0-9]*" | awk '{ print $2}'`
echo "<module>"
echo "<name>Apache Total Accesses</name>"
echo "<type>generic_data_inc</type>"
echo "<data>$AP_TOTACC</data>"
echo "</module>"
echo "<module>"
echo "<name>Apache Request per second</name>"
echo "<type>generic_data</type>"
echo "<data>0$AP_REQSEC</data>"
echo "</module>"
echo "<module>"
echo "<name>Apache Busy Workers</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BUSY</data>"
echo "</module>"
echo "<module>"
echo "<name>Apache BytesPerSecond Served</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_BPS</data>"
echo "</module>"
echo "<module>"
echo "<name>Apache CPULoad</name>"
echo "<type>generic_data</type>"
echo "<data>$AP_CPULOAD</data>"
echo "</module>"

View File

@ -1,34 +0,0 @@
#!/bin/bash
TEMP=/tmp/pandora.plugin.arp
cat /proc/net/stat/arp_cache | tail -1 | tr "[:lower:]" "[:upper:]" > $TEMP
ARP_ENTRIES_T=`cat $TEMP | awk '{ print $1 }'`
ARP_ENTRIES=`echo "ibase=16; $ARP_ENTRIES_T" | bc`
ARP_DESTROY_T=`cat $TEMP | awk '{ print $3 }'`
ARP_DESTROY=`echo "ibase=16; $ARP_DESTROY_T" | bc`
ARP_ALLOC_T=`cat $TEMP | awk '{ print $2 }'`
ARP_ALLOC=`echo "ibase=16; $ARP_ALLOC_T" | bc`
rm $TEMP 2> /dev/null
echo "<module>"
echo "<name>ARP Entries</name>"
echo "<type>generic_data</type>"
echo "<description>Get destroyed entries in Network stack ARP table</description>"
echo "<data>$ARP_ENTRIES</data>"
echo "</module>"
echo "<module>"
echo "<name>ARP Destroy</name>"
echo "<type>generic_data_inc</type>"
echo "<description>Get deleted entries in Network stack ARP table</description>"
echo "<data>$ARP_DESTROY</data>"
echo "</module>"
echo "<module>"
echo "<name>ARP Alloc</name>"
echo "<type>generic_data_inc</type>"
echo "<description>Get allocated entries in Network stack ARP table</description>"
echo "<data>$ARP_ALLOC</data>"
echo "</module>"

View File

@ -1,18 +0,0 @@
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 and XServe Nehalem but the script is built up so it
should acquire any other sensors.
ipmitool and php (tested 5, 4 should work too) is required on the machine the
agent is running on. This incarnation of ipmi2xml has been tested with
ipmitool 2.1.8 (which is part of Apple Server Admin Tools 1.7). Previous
versions might not work (check SVN history for older versions.
Check guruevi's blog post on http://blog.pandorafms.org for more information
on adapting this tool.

View File

@ -1,123 +0,0 @@
#!/usr/bin/php
<?php
$host = "yourserver.example.net";
$user = "youruser";
$pass = "yourpassword";
$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'];
function print_xml_sensor ($name, $data, $type = "generic_proc") {
echo "<module><name>".$name."</name><data>".$data."</data><type>".$type."</type></module>";
}
$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) {
## False is good
case "Power Overload":
case "Main Power Fault":
case "Power Control Fault":
case "Drive Fault":
case "Cooling/Fan Fault":
$data = ($data == "false" ? 1 : 0);
print_xml_sensor ($name, $data);
break;
## Inactive is good
case "Power Interlock":
$data = ($data == "inactive" ? 1 : 0);
print_xml_sensor ($name, $data);
break;
## On is good
case "System Power":
$data = ($data == "on" ? 1 : 0);
print_xml_sensor ($name, $data);
break;
## Off is good
case "Front Panel Light":
$data = ($data == "off" ? 1 : 0);
print_xml_sensor ($name, $data);
break;
## Ignore the following values
case "Last Power Event":
case "Power Restore Policy":
default:
break;
}
}
unset($status);
//End of Chassis
//Begin of Sensor
$array = explode("\n",$output['sensor']);
foreach ($array as $value) {
if($value != "") {
$tmp[] = explode("|",$value);
}
}
/*
Sample $tmp:
[1] => Array
(
[0] => CPU A Core
[1] => 1.264
[2] => Volts
[3] => ok
[4] => na
[5] => na
[6] => 1.000
[7] => 1.368
[8] => na
[9] => na
)
*/
unset ($tmp[0]);
foreach ($tmp as $value_arr) {
if (trim($value_arr[1]) == "na") {
continue;
} elseif (trim($value_arr[2]) == "discrete") {
continue;
}
print_xml_sensor (trim($value_arr[0]).' ('.trim($value_arr[2]).')', trim ($value_arr[1]), "generic_data");
}
//End of Sensor
?>

View File

@ -1,95 +0,0 @@
#!/bin/bash
# -----------------------------------------------------------------
# Netfilter / GNULinux Network IPTables plugin for Pandora FMS
# (c) Sancho Lerena 2008-2009.
# This is an agent plugin, used only on local agents
# NOTE: This agent needs the system command 'bc' to calculate hex data
# -----------------------------------------------------------------
TEMP=/tmp/network.tmp
cat /proc/net/stat/ip_conntrack | tail -1 | tr "[:lower:]" "[:upper:]" > $TEMP
CT_ENTRIES_T=`cat $TEMP | awk '{ print $1 }'`
CT_ENTRIES=`echo "ibase=16; $CT_ENTRIES_T" | bc`
CT_NEW_T=`cat $TEMP | awk '{ print $3 }'`
CT_NEW=`echo "ibase=16; $CT_NEW_T" | bc`
CT_INVALID_T=`cat $TEMP | awk '{ print $4 }'`
CT_INVALID=`echo "ibase=16; $CT_INVALID_T" | bc`
rm $TEMP 2> /dev/null
CONTRACKFILE=/tmp/conntrack.pandora
cat /proc/net/ip_conntrack > $CONTRACKFILE 2> /dev/null
fw_con_established=`cat $CONTRACKFILE | grep ESTABLISH | wc -l`
fw_con_timewait=`cat $CONTRACKFILE | grep TIME_WAIT | wc -l`
fw_con_syn_wait=`cat $CONTRACKFILE | grep SYN_ | wc -l`
fw_con_fin_wait=`cat $CONTRACKFILE | grep FIN_WAIT | wc -l`
fw_con_unreplied=`cat $CONTRACKFILE | grep UNREPLIED | wc -l`
fw_enabled=`cat /proc/sys/net/ipv4/ip_forward`
rm $CONTRACKFILE 2> /dev/null
echo "<module>"
echo "<name>Conntrack Active Entries</name>"
echo "<type>generic_data</type>"
echo "<description>Get active entries in Netfilter conntrack session table</description>"
echo "<data>$CT_ENTRIES</data>"
echo "</module>"
echo "<module>"
echo "<name>Conntrack New</name>"
echo "<type>generic_data_inc</type>"
echo "<description>Get new connections in Netfilter conntrack session table</description>"
echo "<data>$CT_NEW</data>"
echo "</module>"
echo "<module>"
echo "<name>Conntrack Invalid</name>"
echo "<type>generic_data_inc</type>"
echo "<description>Get invalid entries in Netfilter conntrack session table</description>"
echo "<data>$CT_INVALID</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_con_established</name>"
echo "<type>generic_data</type>"
echo "<description>Established connetions on Firewall</description>"
echo "<data>$fw_con_established</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_con_timewait</name>"
echo "<type>generic_data</type>"
echo "<description>Established connections pending to timeout</description>"
echo "<data>$fw_con_timewait</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_con_syn_wait</name>"
echo "<type>generic_data</type>"
echo "<description>Not-established connections, waiting to other side</description>"
echo "<data>$fw_con_syn_wait</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_con_fin_wait</name>"
echo "<type>generic_data</type>"
echo "<description>Established connections waiting FIN on other side</description>"
echo "<data>$fw_con_fin_wait</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_con_unreplied</name>"
echo "<type>generic_data</type>"
echo "<description>Unreplied connection attempts</description>"
echo "<data>$fw_con_unreplied</data>"
echo "</module>"
echo "<module>"
echo "<name>fw_enabled</name>"
echo "<type>generic_proc</type>"
echo "<description>Forwarding enabled</description>"
echo "<data>$fw_enabled</data>"
echo "</module>"

View File

@ -1,56 +0,0 @@
#!/usr/bin/perl
###############################################################################
#
# Copyright (c) 2009 Ramon Novoa <rnovoa@artica.es>
# Copyright (c) 2009 Artica Soluciones Tecnologicas S.L.
#
# pandora_ps Get the status of the given processes.
#
# Sample usage: ./pandora_ps init perl mysqld
#
# 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.
#
###############################################################################
use strict;
# Check command line parameters
if ($#ARGV < 0) {
print "Usage: $0 <process_1> [process_2] ...\n\n";
exit 1;
}
# Parse command line parameters
my %processes;
my $module_name = $ARGV[0];
foreach my $process (@ARGV) {
$processes{$process} = 0;
}
# Retrieve process information
my @df = `ps -eo ucmd`;
shift (@df);
# Parse filesystem usage
foreach my $row (@df) {
chomp ($row);
$processes{$row} = 1 if defined ($processes{$row});
}
while (my ($process, $status) = each (%processes)) {
# Print module output
print "<module>\n";
print " <name><![CDATA[" . $process . "]]></name>\n";
print " <type><![CDATA[generic_data]]></type>\n";
print " <data><value><![CDATA[" . $status . "]]></value></data>\n";
print "</module>\n";
}
exit 0;

View File

@ -0,0 +1,133 @@
# Base config file for Pandora FMS agents
# Version 3.0, AIX version
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
# General Parameters
# ==================
server_ip localhost
server_path /var/spool/pandora/data_in
temporal /var/spool/pandora/data_out
logfile /var/log/pandora/pandora_agent.log
# 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, agent takes machine name
#agent_name xxxxxx
# 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
# Listening TCP port for remote server. By default is 41121 (for tentacle)
# if you want to use SSH use 22, and FTP uses 21.
server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword
# Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default).
# server_ssl no
# Extra options for the Tentacle client (for example, server_opts "-v -r 5").
# server_opts
# delayed_startup defines number of MINUTES before start execution
# for first time when startup Pandora FMS Agent
# delayed_startup 10
# 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 (default)
# pandora_nice 0
# Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use
# of old style cron. You should add to crontab Pandora FMS agent script to use this mode.
# This is disabled by default, and is not recommended. Use Pandora FMS internal scheduler
# is much more safe.
# cron_mode
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# Secondary server configuration
# ==============================
# If secondary_mode is set to on_error, data files are copied to the secondary
# server only if the primary server fails. If set to always, data files are
# always copied to the secondary server.
# secondary_mode on_error
# secondary_server_ip localhost
# secondary_server_path /var/spool/pandora/data_in
# secondary_server_port 41121
# secondary_transfer_mode tentacle
# secondary_server_pwd mypassword
# secondary_server_ssl no
# secondary_server_opts
# Module Definition
# =================
# System information
module_begin
module_name disk_root_free
module_type generic_data
module_exec df -k / | tail -1 | awk '{ print 100-$4 }'
module_max 100
module_min 0
module_description Free disk Percentage of root partition
module_end
module_begin
module_name proctotal
module_type generic_data
module_exec ps aux | wc -l | awk '{ print $1 }'
module_end
# Process information
module_begin
module_name InetdDaemon
module_type generic_proc
module_exec ps -Af | grep inetd | grep -v "grep" | wc -l | awk '{ print $1 }'
module_end
# Async data example
module_begin
module_name LastLogin
module_type async_string
module_exec last | head -1
module_end
module_begin
module_name Pandora_Agent_RAM
module_ẗype generic_data
module_exec ps axu | grep perl | grep -v grep | awk '{ print $4 }' | tr "," "."
module_end
module_plugin grep_log /var/adm/syslog Syslog .

View File

@ -0,0 +1,76 @@
#!/bin/sh
# Pandora FMS Linux Agent, startup script
# Copyright (c) 2006-2009 Artica ST, <info@artica.es>
# AIX 5.x Version (generic),
# v3.0 Build 090810
# http://www.pandorafms.com
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent
LOGFILE=/var/log/pandora_agent.log
# This function replace pidof, not working in the same way in different linux distros
function pidof_pandora {
PANDORA_PID=`ps -Alf | grep $DAEMON | grep -v grep | head -1 | awk '{ print $4 }'`
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 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 "Uso: /etc/rc.pandora_agent_daemon {start|stop|restart|status|force-reload}"
exit 1
esac

View File

@ -0,0 +1,166 @@
# Base config file for Pandora FMS agents
# Version 3.0, Solaris Version
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
# General Parameters
# ==================
server_ip farscape.artica.es
server_path /var/spool/pandora/data_in
temporal /var/spool/pandora/data_out
logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default
interval 300
# Debug mode only generate XML, and stop after first execution,
# and does not copy XML to server.
debug 0
# By default, agent takes machine name
#agent_name xxxxxx
# 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
# Listening TCP port for remote server. By default is 41121 (for tentacle)
# if you want to use SSH use 22, and FTP uses 21.
server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword
# Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default).
# server_ssl no
# Extra options for the Tentacle client (for example, server_opts "-v -r 5").
# server_opts
# delayed_startup defines number of MINUTES before start execution
# for first time when startup Pandora FMS Agent
# delayed_startup 10
# 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 (default)
# pandora_nice 0
# Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use
# of old style cron. You should add to crontab Pandora FMS agent script to use this mode.
# This is disabled by default, and is not recommended. Use Pandora FMS internal scheduler
# is much more safe.
# cron_mode
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# Secondary server configuration
# ==============================
# If secondary_mode is set to on_error, data files are copied to the secondary
# server only if the primary server fails. If set to always, data files are
# always copied to the secondary server.
# secondary_mode on_error
# secondary_server_ip localhost
# secondary_server_path /var/spool/pandora/data_in
# secondary_server_port 41121
# secondary_transfer_mode tentacle
# secondary_server_pwd mypassword
# secondary_server_ssl no
# secondary_server_opts
# Module Definition
# =================
# System information
module_begin
module_name disk_root_free
module_type generic_data
module_exec df -k / | tail -1 | tr -d "%" | awk '{ print 100-$5 }'
module_max 100
module_min 0
module_description Free disk Percentage of root partition
module_end
module_begin
module_name proctotal
module_type generic_data
module_exec ps -Alf | wc -l | awk '{ print $1 }'
module_end
module_begin
module_name sshDaemon
module_type generic_proc
module_exec ps -Af | grep sshd | grep -v "grep" | wc -l | awk '{ print $1 }'
module_end
# Async data example
module_begin
module_name LastLogin
module_type async_string
module_exec last | head -1
module_end
module_begin
module_name Swap_Free
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $4 }'
module_description Unused swap memory
module_end
module_begin
module_name RAM_Free
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $5 }'
module_description Unused RAM memory
module_end
module_begin
module_name CPU_User
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $20 }'
module_description % of USER CPU
module_end
module_begin
module_name CPU_System
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $21 }'
module_description % of system CPU
module_end
module_begin
module_name Disk_Seek_Operations
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $14 }'
module_description Disk Seek operations
module_end
module_begin
module_name Pandora_Agent_RAM
module_ẗype generic_data
module_exec ps -Afly | grep perl | grep -v grep | awk '{ print $9 }'
module_description Return size in KB of memory used by process Pandora
module_end
module_plugin grep_log /var/adm/syslog Syslog .

View File

@ -0,0 +1,76 @@
#!/bin/sh
# Pandora FMS Linux Agent, startup script
# Copyright (c) 2006-2009 Artica ST, <info@artica.es>
# AIX 5.x Version (generic),
# v3.0 Build 090810
# http://www.pandorafms.com
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent
LOGFILE=/var/log/pandora_agent.log
# This function replace pidof, not working in the same way in different linux distros
function pidof_pandora {
PANDORA_PID=`ps -Af | grep $DAEMON | grep -v grep | head -1 | awk '{ print $2 }'`
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 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 "Uso: /etc/init.d/pandora_agent_daemon {start|stop|restart|status|force-reload}"
exit 1
esac

View File

@ -6,8 +6,7 @@ http://pandora.sourceforge.net
How to install
--------------
Please refer to documentation on our website. This includes schemas, quick-install
guides and how to use preconfigured packages and installers for all components.
./pandora_agent_installer --help
What is Pandora FMS?
--------------------
@ -24,31 +23,22 @@ Pandora FMS will adjust, like an octopus, to your systems and requirements,
because it has been designed to be open, modular, multiplattform and easy to
customize. Pandora FMS is developed for system administrators.
What else can Pandora FMS do?
-----------------------------
About the generic Unix agent
----------------------------
Pandora FMS is a monitoring tool that not only measures if a parameter is right
or wrong. Pandora FMS can quantify the state (right or wrong), or store a value
(numeric or alphanumeric) for months if necessary. Pandora FMS can measure
performances, compare values among differen systems and set alarms over
thresholds. Pandora FMS works against a Database so that it can generate
reports, statistics, SLA and meausre anything: Operating Systems, aplications
and hardware systems—such as firewalls, proxies, Databases, web servers, VPN,
routers, switches, processes, services, remote accesses to servers, etc.
everything integrated in a open and distributed architecture. Pandora FMS can be
deployed over any Operating System, with specific agents for each platform.
There are already agents for Windows (2000, XP, 2003), GNU/Linux, Solaris,
HP-UX, BSD, AIX, IPSO and OpenWRT.
This agent is build on Perl and needs the following minimal requisites:
Pandora FMS not only gathers information through its agents, but it can also
monitor any hardware sistem with TCP/IP connectivity —such as load balancing
systems, routers, switches, printers, etc.— through SNMP and TCP/ICMP checks.
PERL version 5.6 or higher.
Often the question "What kind of things can be monitored?" shows up, since
Pandora FMS can —virtually— monitor anthing, sometimes is convenient give some
specific examples. Pandora FMS can monitor any process or system that, though a
command, returns a value, and also any value inside a log file of the Operating
System.
By default this minimum OS has all the requisites to run "standalone":
- Linux: Redhat 6, SUSE 5, Debian 2.x and any distro with Perl 5.6
- IBM AIX: 5.1
- Hewlett Packard HPUX: 11.10 or higher. 11.0 comes with Perl 4.0 :(
- Sun Solaris: 2.9. With 2.8 you can install BlastWare Perl 5.8 package, see more
information in our FAQ about how to install Blashware packages.
- Other Unix: TRU, IRIX, etc not tested, if you want to port the agent to this
unixes, please contact with us, we'll glad to port them !!!
License
-------

View File

@ -0,0 +1,166 @@
# Base config file for Pandora FMS agents
# Version 3.0, Solaris Version
# Licensed under GPL license v2,
# (c) 2003-2009 Artica Soluciones Tecnologicas
# please visit http://pandora.sourceforge.net
# General Parameters
# ==================
server_ip farscape.artica.es
server_path /var/spool/pandora/data_in
temporal /var/spool/pandora/data_out
logfile /var/log/pandora/pandora_agent.log
# Interval in seconds, 300 by default
interval 300
# Debug mode only generate XML, and stop after first execution,
# and does not copy XML to server.
debug 0
# By default, agent takes machine name
#agent_name xxxxxx
# 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
# Listening TCP port for remote server. By default is 41121 (for tentacle)
# if you want to use SSH use 22, and FTP uses 21.
server_port 41121
# Transfer mode: tentacle, ftp, ssh or local
transfer_mode tentacle
# Server password (Tentacle or FTP). Leave empty for no password (default).
# server_pwd mypassword
# Set to yes/no to enable/disable OpenSSL support for Tentacle (disabled by default).
# server_ssl no
# Extra options for the Tentacle client (for example, server_opts "-v -r 5").
# server_opts
# delayed_startup defines number of MINUTES before start execution
# for first time when startup Pandora FMS Agent
# delayed_startup 10
# 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 (default)
# pandora_nice 0
# Cron mode replace Pandora FMS own task schedule each XX interval seconds by the use
# of old style cron. You should add to crontab Pandora FMS agent script to use this mode.
# This is disabled by default, and is not recommended. Use Pandora FMS internal scheduler
# is much more safe.
# cron_mode
# If set to 1 allows the agent to be configured via the web console (Only Enterprise version)
# remote_config 1
# Secondary server configuration
# ==============================
# If secondary_mode is set to on_error, data files are copied to the secondary
# server only if the primary server fails. If set to always, data files are
# always copied to the secondary server.
# secondary_mode on_error
# secondary_server_ip localhost
# secondary_server_path /var/spool/pandora/data_in
# secondary_server_port 41121
# secondary_transfer_mode tentacle
# secondary_server_pwd mypassword
# secondary_server_ssl no
# secondary_server_opts
# Module Definition
# =================
# System information
module_begin
module_name disk_root_free
module_type generic_data
module_exec df -k / | tail -1 | tr -d "%" | awk '{ print 100-$5 }'
module_max 100
module_min 0
module_description Free disk Percentage of root partition
module_end
module_begin
module_name proctotal
module_type generic_data
module_exec ps -Alf | wc -l | awk '{ print $1 }'
module_end
module_begin
module_name sshDaemon
module_type generic_proc
module_exec ps -Af | grep sshd | grep -v "grep" | wc -l | awk '{ print $1 }'
module_end
# Async data example
module_begin
module_name LastLogin
module_type async_string
module_exec last | head -1
module_end
module_begin
module_name Swap_Free
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $4 }'
module_description Unused swap memory
module_end
module_begin
module_name RAM_Free
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $5 }'
module_description Unused RAM memory
module_end
module_begin
module_name CPU_User
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $20 }'
module_description % of USER CPU
module_end
module_begin
module_name CPU_System
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $21 }'
module_description % of system CPU
module_end
module_begin
module_name Disk_Seek_Operations
module_type generic_data
module_exec vmstat 1 2 | tail -1 | awk '{ print $14 }'
module_description Disk Seek operations
module_end
module_begin
module_name Pandora_Agent_RAM
module_ẗype generic_data
module_exec ps -Afly | grep perl | grep -v grep | awk '{ print $9 }'
module_description Return size in KB of memory used by process Pandora
module_end
module_plugin grep_log /var/adm/syslog Syslog .

View File

@ -0,0 +1,76 @@
#!/bin/sh
# Pandora FMS Linux Agent, startup script
# Copyright (c) 2006-2009 Artica ST, <info@artica.es>
# AIX 5.x Version (generic),
# v3.0 Build 090810
# http://www.pandorafms.com
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
PANDORA_PATH=/etc/pandora
DAEMON=/usr/bin/pandora_agent
LOGFILE=/var/log/pandora_agent.log
# This function replace pidof, not working in the same way in different linux distros
function pidof_pandora {
PANDORA_PID=`ps -Af | grep $DAEMON | grep -v grep | head -1 | awk '{ print $2 }'`
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 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 "Uso: /etc/init.d/pandora_agent_daemon {start|stop|restart|status|force-reload}"
exit 1
esac

View File

@ -1,9 +1,9 @@
#
#Pandora FMS Linux Agent
#
%define name pandorafms_agent
%define name pandorafms_agent_unix
%define version 3.0.0
Summary: Pandora FMS Linux agent
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
Version: %{version}
Release: 1
@ -23,11 +23,12 @@ Provides: %{name}-%{version}
%description
Pandora FMS agents are based on native languages in every platform: scripts that can be written in any language. Its possible to reproduce any agent in any programming language and can be extended without difficulty the existing ones in order to cover aspects not taken into account up to the moment.
These scripts are formed by modules that each one gathers a "chunk" of information. Thus, every agent gathers several "chunks" of information; this one is organized in a data set and stored in a single file, called data file.
This is the PERL 5.8 version of Pandora FMS agent. This includes all the advanced features included in 3.0 version, and will be the default agent in future versions.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -q -n linux
%setup -q -n unix
%build
@ -41,20 +42,17 @@ mkdir -p $RPM_BUILD_ROOT/etc/init.d/
mkdir -p $RPM_BUILD_ROOT/var/spool/pandora/data_out
mkdir -p $RPM_BUILD_ROOT/var/log/pandora/
cp -aRf * $RPM_BUILD_ROOT%{prefix}/pandora_agent/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
%if "%{_vendor}" == "redhat"
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
%else
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
%endif
mv $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/tentacle_client $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent $RPM_BUILD_ROOT/usr/bin/
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent_daemon $RPM_BUILD_ROOT/etc/init.d/pandora_agent_daemon
# Checking old config file (if exists)
if [ -f /etc/pandora/pandora_agent.conf ] ; then
cp /etc/pandora/pandora_agent.conf /etc/pandora/pandora_agent.conf.backup
mv /etc/pandora/pandora_agent.conf /etc/pandora/pandora_agent.conf.backup
fi
cp $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.conf $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.conf.rpmnew
cp -aRf $RPM_BUILD_ROOT%{prefix}/pandora_agent/Linux/pandora_agent.conf $RPM_BUILD_ROOT/usr/share/pandora_agent/pandora_agent.conf.rpmnew
if [ -f $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec ] ; then
rm $RPM_BUILD_ROOT%{prefix}/pandora_agent/pandora_agent.spec
fi
@ -67,31 +65,25 @@ rm -Rf $RPM_BUILD_ROOT
exit 0
%post
if [ ! -d /etc/pandora ] ; then
mkdir -p /etc/pandora
fi
if [ ! -f /usr/share/pandora_agent/pandora_agent.conf ] ; then
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
else
cp /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf.backup
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
cp /usr/share/pandora_agent/pandora_agent.conf.rpmnew /usr/share/pandora_agent/pandora_agent.conf
fi
if [ -f /etc/pandora/pandora_agent.conf ] ; then
rm -Rf /etc/pandora/pandora_agent.conf
if [ ! -f /etc/pandora/pandora_agent.conf ] ; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
else
ln -s /usr/share/pandora_agent/pandora_agent.conf.rpmnew /etc/pandora/pandora_agent.conf.rpmnew
fi
if [ ! -e /etc/pandora/plugins ]; then
ln -s /usr/share/pandora_agent/plugins /etc/pandora
fi
if [ ! -e /etc/pandora/pandora_agent.conf ]; then
ln -s /usr/share/pandora_agent/pandora_agent.conf /etc/pandora/pandora_agent.conf
fi
chkconfig -s pandora_agent_daemon on
%preun
@ -102,6 +94,7 @@ rm /etc/init.d/pandora_agent_daemon
/usr/sbin/userdel pandora
rm -Rf /etc/pandora/pandora_agent.conf
rm -Rf /var/log/pandora/pandora_agent* 2> /dev/null
rm -Rf /usr/share/pandora_agent
exit 0
%files

View File

@ -31,42 +31,7 @@ then
exit 1
fi
get_distro () {
# 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
else
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
echo $LINUX_DISTRO
}
uninstall () {
uninstall {
echo "Removing Pandora FMS Agent..."
rm -Rf $PANDORA_BIN
rm -Rf $PANDORA_TEMP
@ -80,10 +45,12 @@ uninstall () {
install () {
DISTRO=`get_distro`
OS_VERSION=`uname -r`
OS_NAME=`uname -s`
OLDFILENAMETMP=`date +"%Y-%m-%d"`
echo "Detecting Linux distribution: $DISTRO"
echo "Detecting Unix distribution: $OS_NAME version $OS_VERSION"
if [ -f $PANDORA_HOME ] && [ "$FORCE" = "0" ]
then
@ -138,7 +105,7 @@ install () {
fi
echo "Copying default agent configuration to $PANDORA_HOME/pandora_agent.conf"
cp pandora_agent.conf $PANDORA_HOME/pandora_agent.conf
cp $OS_NAME/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..."
@ -163,12 +130,18 @@ install () {
chgrp root $PANDORA_LOG
echo "Linking start-up daemon script at $PANDORA_STARTUP";
cp pandora_agent_daemon $PANDORA_STARTUP
if [ "$DISTRO" == "UBUNTU" ]
if [ "$OS_NAME" == "AIX" ]
then
cp $OS_NAME/pandora_agent_daemon /etc/rc.pandora_agent_daemon
else
cp $OS_NAME/pandora_agent_daemon $PANDORA_STARTUP
fi
if [ "$OS_NAME" == "AIX" ]
then
echo "Linking start-up daemon script to /etc/rc2.d";
ln -s /etc/init.d/pandora_agent_daemon /etc/rc2.d/S90pandora_agent
ln -s /etc/rc.pandora_agent_daemon /etc/rc2.d/S90pandora_agent
else
INITLV=`cat /etc/inittab | grep "[0-9]\:initdefault" | cut -f 2 -d ":"`
echo "Linking start-up daemon script to /etc/rc.d/rc$INITLV.d";
@ -186,6 +159,8 @@ install () {
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 " "
echo "Take a look of your
echo " "
}