2011-03-13 Dario Rodriguez <dario.rodriguez@artica.es>

*util/plugin/babel_plugin/plugin_definition.ini, 
	util/plugin/babel_plugin/babel_plugin.sh: Created plugin to connect 
	Pandora FMS with Babel Enterprise. You can create a pspz package for
	this plugin.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4093 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
darode 2011-03-15 18:30:31 +00:00
parent 7128397c61
commit 07818205c3
3 changed files with 117 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2011-03-13 Dario Rodriguez <dario.rodriguez@artica.es>
*util/plugin/babel_plugin/plugin_definition.ini,
util/plugin/babel_plugin/babel_plugin.sh: Created plugin to connect
Pandora FMS with Babel Enterprise. You can create a pspz package for
this plugin.
2011-03-15 Sancho Lerena <slerena@artica.es>
* util/recon_scripts/snmpdevices.pl: Fixed a typo in interface

View File

@ -0,0 +1,96 @@
#!/bin/bash
# Babel Integration Plugin for Pandora FMS
# This plugin uses Bable Enterprise API
# (c) Dario Rodriguez 2011
BABEL_CONSOLE_PATH=""
USER=""
KEY=""
REQUEST=""
PARAMS=""
TOKEN=","
# Help menu
function help {
echo -e "Babel Integration Pandora FMS Plugin. http://pandorafms.com"
echo -e "Syntax:"
echo -e "\t\t-c : babel console path"
echo -e "\t\t-u : user"
echo -e "\t\t[-k] : API key (required if key is set on babel console)"
echo -e "\t\t-r : request"
echo -e "\t\t[-f] : parameters (default '')"
echo -e "\t\t[-s] : separator token (default ',')"
echo -e "Samples:"
echo " ./babel_plugin.sh -s http://127.0.0.1/babel_console -u user -r host_risk -f main_server"
echo ""
exit
}
# Show help if there is no parameters
if [ $# -eq 0 ]
then
help
fi
# Main parsing code
while getopts ":hc:u:k:r:f:s:" optname
do
case "$optname" in
"h")
help
;;
"c")
BABEL_CONSOLE_PATH=$OPTARG
;;
"u")
USER=$OPTARG
;;
"k")
KEY=$OPTARG
;;
"r")
REQUEST=$OPTARG
;;
"f")
PARAMS=$OPTARG
;;
"s")
TOKEN=$OPTARG
;;
?)
help
;;
default)
help
;;
esac
done
# Create API call
API_CALL=$BABEL_CONSOLE_PATH"/include/api.php?user="$USER"&pass="$KEY"&op="$REQUEST"&params="$PARAMS"&token="$TOKEN
# Execute call with wget
DATE=`date +%s%N`
FILE_OUTPUT="temp$DATE"
wget $API_CALL -o /dev/null -O "$FILE_OUTPUT"
# Check if wget was OK
if [ $? -eq 0 ]; then
output=`cat "$FILE_OUTPUT"`
# Check if API call returns some valuer not
if [ "$output" != "" ]; then
echo -n $output
fi
fi
rm "$FILE_OUTPUT"

View File

@ -0,0 +1,14 @@
; This is a sample configuration file
; Comments start with ';', as in php.ini
[plugin_definition]
name = Bable Integration Plugin
filename = babel_plugin.sh
description = This plugin allow the integration between Pandora FMS and Babel Enterprise.
timeout = 300
ip_opt = -c
user_opt = -u
port_opt =
pass_opt =
plugin_type = 0
total_modules_provided = 0