diff --git a/pandora_agents/mac_osx/pandora_user.conf b/pandora_agents/mac_osx/pandora_user.conf new file mode 100755 index 0000000000..d764ec0368 --- /dev/null +++ b/pandora_agents/mac_osx/pandora_user.conf @@ -0,0 +1,81 @@ +# Pandora User-Defined adquisition script +# This code is under GPL licence +# This is the default user script file +# If you're using this is because default config doest fit all your needs +# You can use the following variables +# +# All STDOUT output will be written in final XML file sent to Pandora Server. +# +# Please refer documentatation for more example and a more depth usage instructions +# + +# ================================ +# Temperature monitoring Mac OS X +# =============================== + +echo `ioreg -n IOHWSensor | awk '/location/ || /current-value/ || /"type"/' | sed -e 's/\n//' -e 's/[^"]*"//' -e 's/" =//' -e 's/"//g' | awk '{ d=($2/65536); if ($1=="current-value") print "" substr(d,1,7) ""; if ($1=="location") print "" $2 " " $3 " " $4 " " $5 "generic_data";}'` + +# ================================ +# Check for WEBPage content change +# ================================ + +#MYMD5=`echo -e "GET / HTTP/1.0\n\n\n" | nc -w 30 www.artica.es 80 | grep -v "Date:" | md5sum | awk '{ print $1 }'` +#VALIDMD5=e85c0b9018a22c1086c8e0179cd224b1 +#if [ "$MYMD5" != "$VALIDMD5" ] +#then +# MD5SUM=0 +#else +# MD5SUM=1 +#fi +#echo "" +#echo "www.artica.es_WEBContenct" +#echo "generic_proc" +#echo "$MD5SUM" +#echo "" + +# MODULE END ======================== + +# ================================ +# Check for DNS Entry change +# ================================ + +#HOSTNAME=arcadia.genterara.com +#MAXHOPS=1 +#MAXHOPS2=`expr $MAXHOPS + 1` +#SALIDA=`traceroute -n $HOSTNAME -w 5 -m $MAXHOPS2 2> /dev/null | awk '{ print $1 }' | tail -1` +# if SALIDA != MAXHOPS, error (more than MAXHOPS hop, if this is our local IP, no more than MAXHOPS hop its needed +#if [ "$SALIDA" == "$MAXHOPS" ] +#then +# DNS_STATUS=1 +#else +# DNS_STATUS=0 +#fi +#echo "" +#echo "DNS_CHECK" +#echo "generic_proc" +#echo "$DNS_STATUS" +#echo "" + +# MODULE END ======================== + + +# ================================ +# Check for DNS Entry change +# on local interface ppp0 +# ================================ + +# PLC_DNS=`dig @194.179.1.101 plc.genterara.com A +short | tail -1 ` +# PLC_LOCAL=`ifconfig ppp0 | head -2 | tail -1 | tr -s ":" " " | awk ' { print $3 } '` +# if [ "$PLC_DNS" == "$PLC_LOCAL" ] +# then +# PLC_STATUS=1 +# else +# PLC_STATUS=0 +# fi +# +# echo "" +# echo "PLC_DNS_CHECK" +# echo "generic_proc" +# echo "$PLC_STATUS" +# echo "" +# MODULE END ======================== diff --git a/pandora_agents/tools/ipmi2xml/README.txt b/pandora_agents/tools/ipmi2xml/README.txt new file mode 100644 index 0000000000..c938032e4e --- /dev/null +++ b/pandora_agents/tools/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/tools/ipmi2xml/ipmi2xml.txt b/pandora_agents/tools/ipmi2xml/ipmi2xml.txt new file mode 100644 index 0000000000..3d39741a3c --- /dev/null +++ b/pandora_agents/tools/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 + +?>