Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replacing of "RENAME" command usage by "SED" because some platform do…

…esn't contain the mentioned command.
  • Loading branch information...
commit fb446e1d4b584a5abd7cc67c771d3cf7377d4480 1 parent 0f66b97
@shunanya shunanya authored
View
3  Memcached-monitor/monitor/monitis_api.sh
@@ -303,7 +303,8 @@ function get_monitorID {
MSG="get_monitorID - Not a Json"
fi
else #array
- tmp=$(echo $response | replace "[{" "{" | replace "}]" "}" | replace "}," "} | " | replace "{" " {" | replace "})" "} )" )
+ #tmp=$(echo $response | replace "[{" "{" | replace "}]" "}" | replace "}," "} | " | replace "{" " {" | replace "})" "} )" )
+ tmp=`jsonArray2ss "${response}" `
set -- "$tmp"
OIFS=$IFS
IFS="|"
View
4 Memcached-monitor/monitor/monitis_constant.sh
@@ -5,8 +5,8 @@
declare -r SERVER="http://www.monitis.com/" # Monitis server
declare -r API_PATH="customMonitorApi" # Custom API path
-declare -r APIKEY="2K3GFQ1SU0JO8UD9OIKAVG9SE8" # ApiKey - REPLACE it by your key's value (can be obtained from your Monitis account)
-declare -r SECRETKEY="LLTSDOJ6244CDA899R4H949TE" # SecretKey - REPLACE it by your key's value (can be obtained from your Monitis account)
+declare -r APIKEY="T5BAQQ46JPTGR6EBLFE28OSSQ" # ApiKey - REPLACE it by your key's value (can be obtained from your Monitis account)
+declare -r SECRETKEY="248VUB2FA3DST8J31A9U6D9OHT" # SecretKey - REPLACE it by your key's value (can be obtained from your Monitis account)
declare -r APIVERSION="2" # Version of existing Monitis Open API
declare -r OUTPUT_TYPE="JSON" # Output type that is used in the current project implementation
View
9 Memcached-monitor/monitor/monitis_util.sh
@@ -43,6 +43,15 @@ function trim {
echo $*
}
+# Convert json array to set of json objects separated by "|"
+# @param $1 - array string to be transformed
+# returns result into "response" variable
+# sample:
+# [{id:1},{id:2}] -> {id:1} | {id:2}
+jsonArray2ss(){
+ echo -E "$@" | sed 's/\[{/{/g;s/}\]/}/g;s/},/} \| /g;s/{/ {/g;s/})/} )/g'
+}
+
# Tests whether *entire string* is JSON string
# @param $1 - string to be checked
function isJSON(){
View
6 Memcached-monitor/monitor/monitor_constant.sh
@@ -9,6 +9,12 @@ declare MONITOR_NAME="Memcached_$HOST_IP-$MEMCACHED_IP:$MEMCACHED_PORT" # nam
declare -r MONITOR_TAG="memcached" # tag for custom monitor
declare -r MONITOR_TYPE="BASH_Monitor" # type for custom monitor
#declare -r MONITOR_TYPE="custom" # type for custom monitor
+# monitor commands
+declare -r MON_PATHNAME="node_monitor"
+declare -r MON_ACTION="action"
+declare -r MON_GET_DATA="getData"
+declare -r MON_GET_ADATA="getAData"
+
# format of result params - name1:displayName1:uom1:Integer
declare -r P1="status:status::3;uptime:uptime::3"
declare -r P2="get_miss:get_miss:perc:4;delete_miss:delete_miss:perc:4;incr_miss:incr_miss:perc:4;decr_miss:decr_miss:perc:4;evictions:evictions:perc:4"
Please sign in to comment.
Something went wrong with that request. Please try again.