2013-11-26 KIKUCHI koichiro <koichiro@rworks.jp>

* util/pandora_remote_agent.sh: Added "-e" option to be able to
	 specify character encoding of the output XML. Also added PID
	 number to the output file name to avoid race conditions.
 


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9128 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
koichirok 2013-11-26 10:56:49 +00:00
parent 69d6ac7205
commit 0383fec2eb
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-11-26 KIKUCHI koichiro <koichiro@rworks.jp>
* util/pandora_remote_agent.sh: Added "-e" option to be able to
specify character encoding of the output XML. Also added PID
number to the output file name to avoid race conditions.
2013-11-26 KIKUCHI koichiro <koichiro@rworks.jp> 2013-11-26 KIKUCHI koichiro <koichiro@rworks.jp>
* lib/PandoraFMS/DB.pm: Fixed get_agent_status to return warning status * lib/PandoraFMS/DB.pm: Fixed get_agent_status to return warning status

View File

@ -17,6 +17,7 @@ function help {
echo -e "Syntax:" echo -e "Syntax:"
echo -e "\t-a agent Agent name as will be presented in the output XML" echo -e "\t-a agent Agent name as will be presented in the output XML"
echo -e "\t-f scriptfile Script file to execute. It must generate the XML for modules itself" echo -e "\t-f scriptfile Script file to execute. It must generate the XML for modules itself"
echo -e "\t-e encoding Character encoding of the agent name and scriptfile output (default: $ENCODING)"
echo -e "\t-h This help" echo -e "\t-h This help"
echo "" echo ""
exit exit
@ -30,7 +31,7 @@ fi
AGENT="" AGENT=""
SCRIPTFILE="" SCRIPTFILE=""
while getopts ":h:a:f:" optname while getopts ":h:a:f:e:" optname
do do
case "$optname" in case "$optname" in
"h") "h")
@ -41,7 +42,10 @@ while getopts ":h:a:f:" optname
;; ;;
"f") "f")
SCRIPTFILE=$OPTARG SCRIPTFILE=$OPTARG
;; ;;
"e")
ENCODING=$OPTARG
;;
?) ?)
help help
;; ;;
@ -70,7 +74,7 @@ TIMESTAMP=`date +"%Y/%m/%d %H:%M:%S"`
SERIAL=`date +"%s"` SERIAL=`date +"%s"`
# File names # File names
DATA=$TEMP/$AGENT.$SERIAL.data DATA=$TEMP/$AGENT.$$.$SERIAL.data
# Makes data packet # Makes data packet
echo "<?xml version=\"1.0\" encoding=\"$ENCODING\"?> " > $DATA echo "<?xml version=\"1.0\" encoding=\"$ENCODING\"?> " > $DATA