diff --git a/pandora_agents/tools/XServeRAID/README.txt b/pandora_agents/linux/plugins/XServeRAID/README.txt similarity index 100% rename from pandora_agents/tools/XServeRAID/README.txt rename to pandora_agents/linux/plugins/XServeRAID/README.txt diff --git a/pandora_agents/tools/XServeRAID/check_xserve b/pandora_agents/linux/plugins/XServeRAID/check_xserve similarity index 100% rename from pandora_agents/tools/XServeRAID/check_xserve rename to pandora_agents/linux/plugins/XServeRAID/check_xserve diff --git a/pandora_agents/tools/XServeRAID/pandora_agent.conf b/pandora_agents/linux/plugins/XServeRAID/pandora_agent.conf similarity index 100% rename from pandora_agents/tools/XServeRAID/pandora_agent.conf rename to pandora_agents/linux/plugins/XServeRAID/pandora_agent.conf diff --git a/pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm b/pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm similarity index 100% rename from pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm rename to pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm diff --git a/pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm b/pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm similarity index 100% rename from pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm rename to pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm diff --git a/pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2.tar.gz b/pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2.tar.gz similarity index 100% rename from pandora_agents/tools/XServeRAID/xserve-raid-tools-1.2.tar.gz rename to pandora_agents/linux/plugins/XServeRAID/xserve-raid-tools-1.2.tar.gz diff --git a/pandora_agents/tools/ipmi2xml/README.txt b/pandora_agents/linux/plugins/ipmi2xml/README.txt similarity index 100% rename from pandora_agents/tools/ipmi2xml/README.txt rename to pandora_agents/linux/plugins/ipmi2xml/README.txt diff --git a/pandora_agents/tools/ipmi2xml/ipmi2xml.txt b/pandora_agents/linux/plugins/ipmi2xml/ipmi2xml.txt similarity index 100% rename from pandora_agents/tools/ipmi2xml/ipmi2xml.txt rename to pandora_agents/linux/plugins/ipmi2xml/ipmi2xml.txt diff --git a/pandora_agents/mac_osx/pandora_agent.conf b/pandora_agents/mac_osx/pandora_agent.conf index f785823c58..78b40b09dd 100755 --- a/pandora_agents/mac_osx/pandora_agent.conf +++ b/pandora_agents/mac_osx/pandora_agent.conf @@ -8,30 +8,30 @@ # 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 +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 +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 # By default agent try to take default encoding defined in host. -# encoding iso-8859-15 +# 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 +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,14 +57,15 @@ 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_begin module_name CPU (User) module_type generic_data module_interval 1 @@ -74,7 +75,7 @@ module_min 0 module_descripcion User CPU Usage (%) module_end -module_begin +module_begin module_name CPU (System) module_type generic_data module_exec iostat -C | tail -1 | awk '{ print $11 }' @@ -83,8 +84,8 @@ module_min 0 module_description System CPU Usage (%) module_end -module_begin -module_name Disk Space on / (Available) +module_begin +module_name Disk Space on / (Available) module_type generic_data module_exec df -kh / | tail -1 | awk '{ print 100-$5 }' module_max 100 @@ -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,41 +132,7 @@ 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 +# Networking module_begin module_name Network Packets (Incoming) @@ -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 diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/README.txt b/pandora_agents/mac_osx/plugins/XServeRAID/README.txt new file mode 100644 index 0000000000..c3212d1ad8 --- /dev/null +++ b/pandora_agents/mac_osx/plugins/XServeRAID/README.txt @@ -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. \ No newline at end of file diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/check_xserve b/pandora_agents/mac_osx/plugins/XServeRAID/check_xserve new file mode 100755 index 0000000000..43d33466f8 --- /dev/null +++ b/pandora_agents/mac_osx/plugins/XServeRAID/check_xserve @@ -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 diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/pandora_agent.conf b/pandora_agents/mac_osx/plugins/XServeRAID/pandora_agent.conf new file mode 100644 index 0000000000..885f1b3e4a --- /dev/null +++ b/pandora_agents/mac_osx/plugins/XServeRAID/pandora_agent.conf @@ -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 "" | 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 "" | 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 "" | 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 "" | 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 "" | 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 "" | 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 + diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm new file mode 100644 index 0000000000..7741d43917 Binary files /dev/null and b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.rhel3.i386.rpm differ diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm new file mode 100644 index 0000000000..81a1eefcca Binary files /dev/null and b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2-1.uwhep.sl4.i386.rpm differ diff --git a/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2.tar.gz b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2.tar.gz new file mode 100644 index 0000000000..aad5dfc6d2 Binary files /dev/null and b/pandora_agents/mac_osx/plugins/XServeRAID/xserve-raid-tools-1.2.tar.gz differ diff --git a/pandora_agents/mac_osx/plugins/ipmi2xml/README.txt b/pandora_agents/mac_osx/plugins/ipmi2xml/README.txt new file mode 100644 index 0000000000..c938032e4e --- /dev/null +++ b/pandora_agents/mac_osx/plugins/ipmi2xml/README.txt @@ -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. \ No newline at end of file diff --git a/pandora_agents/mac_osx/plugins/ipmi2xml/ipmi2xml.txt b/pandora_agents/mac_osx/plugins/ipmi2xml/ipmi2xml.txt new file mode 100644 index 0000000000..3d39741a3c --- /dev/null +++ b/pandora_agents/mac_osx/plugins/ipmi2xml/ipmi2xml.txt @@ -0,0 +1,147 @@ +#!/usr/bin/php +28.5DRIVE BAYgeneric_data +*/ +$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 "" . $name . "" . $data_out . "generic_proc"; + } +} +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" . $name . ""; + if($status["Lower Non-Critical"] != "na") { + $min = "" . $status["Lower Non-Critical"] . ""; + } + if($status["Upper Non-Critical"] != "na") { + $max = "" . $status["Upper Non-Critical"] . ""; + } + if($status["Lower Critical"] != "na") { + $min = "" . $status["Lower Critical"] . ""; + } + if($status["Upper Critical"] != "na") { + $max = "" . $status["Upper Critical"] . ""; + } + echo $min . $max . "" . $data_tmp[0] . "generic_data"; +} + + +//$data_out = ($data="false" ? "1" : "0"); +//$data_out = ($data="off" ? "1" : "0"); + + unset($status); +} + +//End of Sensor + +?> diff --git a/pandora_agents/mac_osx/pandora_user.conf b/pandora_agents/mac_osx/plugins/ppc_sensors similarity index 100% rename from pandora_agents/mac_osx/pandora_user.conf rename to pandora_agents/mac_osx/plugins/ppc_sensors diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index c70f85a95b..c27d967d5c 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -28,31 +28,51 @@ 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 - useradd pandora - mkdir /home/pandora - mkdir /home/pandora/.ssh - chown -R pandora /home/pandora + 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 - cp pandora_* /etc/init.d/ - rm /etc/init.d/pandora_server_installer - ln -s /etc/init.d/pandora_server /etc/rc2.d/S90pandora_server - ln -s /etc/init.d/pandora_recon /etc/rc2.d/S90pandora_recon - ln -s /etc/init.d/pandora_network /etc/rc2.d/S90pandora_network - 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 + 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 + ln -s /etc/init.d/pandora_recon /etc/rc2.d/S90pandora_recon + ln -s /etc/init.d/pandora_network /etc/rc2.d/S90pandora_network + 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,19 +94,33 @@ else mkdir /usr/share/pandora cp -R util /usr/share/pandora cp -R plugin /usr/share/pandora - 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 + 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 () { - echo "Removing Pandora Servers" + 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 - rm -Rf /var/log/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 rm -Rf /etc/init.d/pandora_network