Commit 2053a3ef authored by Hardik Juneja's avatar Hardik Juneja Committed by Rafael Monnerat

stack/erp5: Accept apachdex parameters as raw text

parent 4c0d4d6f
......@@ -87,7 +87,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
[template-erp5]
filename = instance-erp5.cfg.in
md5sum = bf28cc3cde65b251cabbeb285a45bdc7
md5sum = 8d9420da8f22dd41d5f076d7506a6620
[template-zeo]
filename = instance-zeo.cfg.in
......@@ -99,11 +99,11 @@ md5sum = a2377d5c53fd2a441ea713b428e4844b
[template-balancer]
filename = instance-balancer.cfg.in
md5sum = c53f977a9ff5683013d2712e4d11cb28
md5sum = d14ee7f13e2bd815cc96e28101e59670
[apdex-result-check-script]
filename = instance-balancer-check-apachedex-result.sh.in
md5sum = cdc5e22560a26e072bade314bd4c506e
md5sum = 421c68c97cadc49911382cd3185288a1
[template-haproxy-cfg]
filename = haproxy.cfg.in
......
......@@ -29,12 +29,12 @@ if [ ! -s "$APACHEDEX_FILE" ]; then
else
# Check if the result exists
{
REGEX="<th>apdex.*?<tr><td [^<]*>(.*?)%<\/td>"
FILE_CONTENT=`cat $APACHDEX_FILE`
REGEX="Overall<\/h2><table .*><tr>[[:space:]]<th>apdex<\/th><th>.*?<tr>[[:space:]]<td [^<]*>(.*?)%<\/td>"
FILE_CONTENT=`cat $APACHEDEX_FILE`
if [[ $FILE_CONTENT =~ $REGEX ]]
then
RESULT=${BASH_REMATCH[1]}
RESULT=${THRESHOLD:-0}
RESULT=${RESULT:-0}
if [[ `echo "$RESULT > $DESIRED_THRESHOLD" | bc` -eq 1 ]]
then
echo "Your score is $RESULT %, Thanks for keeping it all clean"
......
......@@ -287,17 +287,14 @@ apachedex = ${monitor-directory:private}/apachedex
[{{ section('monitor-generate-apachedex-report') }}]
recipe = slapos.cookbook:wrapper
wrapper-path = ${monitor-directory:reports}/${:command}
command-line = "{{ parameter_dict['run-apachedex-location'] }}" "{{ parameter_dict['apachedex-location'] }}" "${directory:apachedex}" ${monitor-publish-parameters:monitor-base-url}/private/apachedex --default "${apachedex-parameters:default}" --apache-log-list "${apachedex-parameters:apache-log-list}" --base-list "${apachedex-parameters:base-list}" --skip-base-list "${apachedex-parameters:skip-base-list}" --erp5-base-list "${apachedex-parameters:erp5-base-list}"
command-line = "{{ parameter_dict['run-apachedex-location'] }}" "{{ parameter_dict['apachedex-location'] }}" "${directory:apachedex}" ${monitor-publish-parameters:monitor-base-url}/private/apachedex --apache-log-list "${apachedex-parameters:apache-log-list}" --config "${apachedex-parameters:configuration}"
command = apachedex_every_3_hour
[apachedex-parameters]
# XXX - Sample log file with curent date: apache_access.log-%(date)s.gz
# which will be equivalent to apache_access.log-20150112.gz if the date is 2015-01-12
apache-log-list = ${apache-conf-parameter-dict:access-log}
default = {{ slapparameter_dict['apachedex-default'] }}
base-list = {{ slapparameter_dict['apachedex-base-list'] }}
skip-base-list = {{ slapparameter_dict['apachedex-skip-base-list'] }}
erp5-base-list = {{ slapparameter_dict['apachedex-erp5-base-list'] }}
configuration = {{ slapparameter_dict['apachedex-configuration'] }}
promise-threshold = {{ slapparameter_dict['apachedex-promise-threshold'] }}
[{{ section('monitor-promise-apachedex-result') }}]
......
......@@ -282,11 +282,9 @@ config-caucase-url = ${request-caucase:connection-http-url}
config-crl-update-periodicity = {{ crl_update_period }}
config-backend-path-dict = {{ dumps(zope_backend_path_dict) }}
config-ssl-authentication-dict = {{ dumps(ssl_authentication_dict) }}
config-apachedex-default = {{ dumps(monitor_dict.get('apachedex-default', '')) }}
config-apachedex-base-list = {{ dumps(monitor_dict.get('apachedex-base-list', '')) }}
config-apachedex-erp5-base-list = {{ dumps(monitor_dict.get('apachedex-erp5-base-list', '')) }}
config-apachedex-skip-base-list = {{ dumps(monitor_dict.get('apachedex-skip-base-list', '')) }}
config-apachedex-promise-threshold = {{ dumps(monitor_dict.get('apachedex-promise-threshold', 0.5)) }}
config-apachedex-promise-threshold = {{ dumps(monitor_dict.get('apachedex-promise-threshold', 70)) }}
config-apachedex-configuration = {{ dumps(monitor_dict.get('apachedex-configuration',
'--erp5-base "/erp5(/|$|/\?)" --skip-user-agent Zabbix --error-detail --js-embed --quiet')) }}
[request-frontend-base]
{% if has_frontend -%}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment