From 29e29ec6dde5267827150ef4b95f25629221099f Mon Sep 17 00:00:00 2001 From: darode Date: Wed, 16 Mar 2011 16:11:16 +0000 Subject: [PATCH] 2011-03-16 Dario Rodriguez * util/plugin/create_integria_incident.sh: Create script to create a new incident in Integria, this script could be used as an action in Pandora FMS. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4100 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 + .../util/plugin/create_integria_incident.sh | 91 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100755 pandora_server/util/plugin/create_integria_incident.sh diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 1e20c4424f..56f9482d81 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-03-16 Dario Rodriguez + + * util/plugin/create_integria_incident.sh: Create script to create a new + incident in Integria, this script could be used as an action in Pandora FMS. + 2011-03-16 Dario Rodriguez * util/plugin/integria_plugin/, diff --git a/pandora_server/util/plugin/create_integria_incident.sh b/pandora_server/util/plugin/create_integria_incident.sh new file mode 100755 index 0000000000..2802258936 --- /dev/null +++ b/pandora_server/util/plugin/create_integria_incident.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# Integria Plugin for Pandora FMS +# This plugin uses Integria API +# (c) Dario Rodriguez 2011 + +INTEGRIA_CONSOLE_PATH="" +USER="" +REQUEST="create_incident" +KEY="" +TITLE="" +DESC="" +PRIORITY="" +GROUP="" +INVENTORY="" + +# 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-t : Indicent title" + echo -e "\t\t-d : Indicent description" + echo -e "\t\t-p : Indicent priority" + echo -e "\t\t-g : ID indicent group" + echo -e "\t\t-i : ID indicent inventory" + echo -e "Samples:" + echo " ./create_integria_incident.sh -c http://127.0.0.1/integria -u user -t \"Incident title\" -d \"Incident description\" -p 4 -g 5 -i 8" + echo "" + exit +} + +# Show help if there is no parameters + +if [ $# -eq 0 ] +then + help +fi + +# Main parsing code + +while getopts ":hc:u:k:t:d:p:g:i:" optname + do + case "$optname" in + "h") + help + ;; + "c") + INTEGRIA_CONSOLE_PATH=$OPTARG + ;; + "u") + USER=$OPTARG + ;; + "k") + KEY=$OPTARG + ;; + "t") + TITLE=$OPTARG + ;; + "d") + DESC=$OPTARG + ;; + "p") + PRIORITY=$OPTARG + ;; + "g") + GROUP=$OPTARG + ;; + "i") + INVENTORY=$OPTARG + ;; + ?) + help + ;; + default) + help + ;; + + esac +done + +# Create params for API call + +PARAMS=$TITLE","$GROUP","$PRIORITY","$DESC","$INVENTORY + +# Create API call +API_CALL=$INTEGRIA_CONSOLE_PATH"/include/api.php?user="$USER"&pass="$KEY"&op="$REQUEST"¶ms="$PARAMS + +wget "$API_CALL" -o /dev/null -O /dev/null