2011-03-16 Dario Rodriguez <dario.rodriguez@artica.es>
* util/plugin/integria_plugin/, util/plugin/integria_plugin/plugin_definition.ini, util/plugin/integria_plugin/integria_plugin.sh, util/plugin/integria_plugin/README: Created integria plugin for Pandora. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4097 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
66f5931816
commit
42da504c21
|
@ -1,3 +1,10 @@
|
|||
2011-03-16 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* util/plugin/integria_plugin/,
|
||||
util/plugin/integria_plugin/plugin_definition.ini,
|
||||
util/plugin/integria_plugin/integria_plugin.sh,
|
||||
util/plugin/integria_plugin/README: Created integria plugin for Pandora.
|
||||
|
||||
2011-03-16 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* util/plugin/babel_plugin/babel_plugin.sh: Fixed an error in help text
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
############################################
|
||||
# #
|
||||
# Integria Plugin for Pandora FMS #
|
||||
# #
|
||||
############################################
|
||||
|
||||
This plugin provide access to Integria API to gather data to be monitored
|
||||
with Pandora FMS.
|
||||
|
||||
This plugin has the following requirements:
|
||||
|
||||
1.- You need a Integira installed with the API enable.
|
||||
|
||||
2.- This plugin was developed to collect single data not arrays of values
|
||||
so you only can collect for example the number of incidents open.
|
||||
You can NOT monitor all incidents you need to specify a parameter of
|
||||
one ot them indicent
|
||||
|
||||
If you need more information about plugin parameters just type:
|
||||
|
||||
$> ./integria_plugin -h
|
||||
|
||||
You can see more information about Integria API at:
|
||||
|
||||
http://www.openideas.info/wiki/index.php?title=Integria
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/bash
|
||||
# Integria Plugin for Pandora FMS
|
||||
# This plugin uses Integria API
|
||||
# (c) Dario Rodriguez 2011
|
||||
|
||||
INTEGRIA_CONSOLE_PATH=""
|
||||
USER=""
|
||||
KEY=""
|
||||
REQUEST=""
|
||||
PARAMS=""
|
||||
TOKEN=","
|
||||
|
||||
# Help menu
|
||||
|
||||
function help {
|
||||
echo -e "Integria Plugin for Pandora FMS. http://pandorafms.com"
|
||||
echo -e "Syntax:"
|
||||
echo -e "\t\t-c : integria console path"
|
||||
echo -e "\t\t-u : user"
|
||||
echo -e "\t\t[-k] : API key (required if key is set on integria 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 " ./integria_plugin.sh -c http://127.0.0.1/integria -u user -r get_stats -f total_incidents"
|
||||
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")
|
||||
INTEGRIA_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=$INTEGRIA_CONSOLE_PATH"/include/api.php?user="$USER"&pass="$KEY"&op="$REQUEST"¶ms="$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"
|
|
@ -0,0 +1,14 @@
|
|||
; This is a sample configuration file
|
||||
; Comments start with ';', as in php.ini
|
||||
|
||||
[plugin_definition]
|
||||
name = Integria Plugin
|
||||
filename = integria_plugin.sh
|
||||
description = This plugin allow the integration between Pandora FMS and Integria.
|
||||
timeout = 300
|
||||
ip_opt = -c
|
||||
user_opt = -u
|
||||
port_opt =
|
||||
pass_opt =
|
||||
plugin_type = 0
|
||||
total_modules_provided = 0
|
Loading…
Reference in New Issue