Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Rasihov <denis.rasihov@zabbix.com>2022-06-01 15:55:44 +0300
committerDenis Rasihov <denis.rasihov@zabbix.com>2022-06-01 15:55:44 +0300
commit0464f618ebd4f125ff8e377d85774413e52dc0d4 (patch)
treebdeee22597b848a5e1eb93dc50d98bcfe3605b26 /templates/san
parent769997961268253a9d719a5fd0654b9ee522fecd (diff)
.........T [ZBXNEXT-7630] updated JS in HPE MSA templates
Diffstat (limited to 'templates/san')
-rw-r--r--templates/san/hpe_msa2040_http/README.md2
-rw-r--r--templates/san/hpe_msa2040_http/template_san_hpe_msa2040_http.yaml37
-rw-r--r--templates/san/hpe_msa2060_http/README.md2
-rw-r--r--templates/san/hpe_msa2060_http/template_san_hpe_msa2060_http.yaml33
4 files changed, 45 insertions, 29 deletions
diff --git a/templates/san/hpe_msa2040_http/README.md b/templates/san/hpe_msa2040_http/README.md
index 4309fb8ccaa..76c91230462 100644
--- a/templates/san/hpe_msa2040_http/README.md
+++ b/templates/san/hpe_msa2040_http/README.md
@@ -166,7 +166,7 @@ There are no template links in this template.
|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----|----|----|
-|There are errors in method requests to API |<p>There are errors in method requests to API.</p> |`length(last(/HPE MSA 2040 Storage by HTTP/hpe.msa.data.errors))>2` |AVERAGE |<p>**Depends on**:</p><p>- Service is down or unavailable</p> |
+|There are errors in method requests to API |<p>There are errors in method requests to API.</p> |`length(last(/HPE MSA 2040 Storage by HTTP/hpe.msa.data.errors))>0` |AVERAGE |<p>**Depends on**:</p><p>- Service is down or unavailable</p> |
|System health is in degraded state |<p>System health is in degraded state.</p> |`last(/HPE MSA 2040 Storage by HTTP/hpe.msa.system.health)=1` |WARNING | |
|System health is in fault state |<p>System health is in fault state.</p> |`last(/HPE MSA 2040 Storage by HTTP/hpe.msa.system.health)=2` |AVERAGE | |
|System health is in unknown state |<p>System health is in unknown state.</p> |`last(/HPE MSA 2040 Storage by HTTP/hpe.msa.system.health)=3` |INFO | |
diff --git a/templates/san/hpe_msa2040_http/template_san_hpe_msa2040_http.yaml b/templates/san/hpe_msa2040_http/template_san_hpe_msa2040_http.yaml
index 204120ad68d..4a25843299f 100644
--- a/templates/san/hpe_msa2040_http/template_san_hpe_msa2040_http.yaml
+++ b/templates/san/hpe_msa2040_http/template_san_hpe_msa2040_http.yaml
@@ -1,6 +1,6 @@
zabbix_export:
version: '6.0'
- date: '2022-05-31T14:53:20Z'
+ date: '2022-06-01T12:48:50Z'
groups:
-
uuid: 7c2cb727f85b492d88cd56e17127c64d
@@ -55,7 +55,7 @@ zabbix_export:
triggers:
-
uuid: 7f80562a0b4f4329be454c418de3f517
- expression: 'length(last(/HPE MSA 2040 Storage by HTTP/hpe.msa.data.errors))>2'
+ expression: 'length(last(/HPE MSA 2040 Storage by HTTP/hpe.msa.data.errors))>0'
name: 'There are errors in method requests to API'
priority: AVERAGE
description: 'There are errors in method requests to API.'
@@ -112,11 +112,11 @@ zabbix_export:
var response, request = new HttpRequest();
request.addHeader('datatype: xml');
- auth_string = md5(params.username + '_' + params.password)
+ auth_string = md5(params.username + '_' + params.password);
response = request.get(params.base_url + 'api/login/' + auth_string);
if (request.getStatus() < 200 || request.getStatus() >= 300) {
- throw 'Request failed with status code ' + request.getStatus() + ': ' + response;
+ throw 'Authentication request has failed with status code ' + request.getStatus() + ': ' + response;
}
if (response !== null) {
@@ -125,7 +125,7 @@ zabbix_export:
return_code = XML.query(response, '/RESPONSE/OBJECT/PROPERTY[@name="return-code"]/text()');
}
catch (error) {
- throw 'Failed to parse auth response received from device API. Check debug log for more information.';
+ throw 'Failed to parse authentication response received from device API.';
}
}
@@ -133,21 +133,23 @@ zabbix_export:
throw 'Authentication failed.'
}
else if (session_key === '') {
- throw 'Failed to retrieve session key from auth response.';
+ throw 'Failed to retrieve session key from authentication response.';
}
- request = new HttpRequest();
+ request.clearHeader();
request.addHeader('sessionKey: ' + session_key);
request.addHeader('datatype: api-embed');
- data['errors'] = [];
+ data.errors = [];
methods.forEach(function (method) {
response = request.get(params.base_url + 'api/show/' + method);
- method_error = {};
+ method_error = '';
if (request.getStatus() < 200 || request.getStatus() >= 300) {
- method_error[method] = 'Request failed with status code ' + request.getStatus() + ': ' + response;
+ method_error = 'Method: ' + method + '. Request has failed with status code ' + request.getStatus() + ': ' + response;
+ data.errors.push(method_error);
+ return;
}
if (response !== null) {
@@ -158,7 +160,7 @@ zabbix_export:
result_tmp.RESPONSE.OBJECT.forEach(function (object) {
var data_tmp = {};
- if (object['@basetype'] != 'status' && object['@basetype'] != 'enclosure-sku') {
+ if (object['@basetype'] !== 'status' && object['@basetype'] !== 'enclosure-sku') {
object.PROPERTY.forEach(function (property) {
name = property['@name'];
value = property['#text'] || '';
@@ -174,15 +176,22 @@ zabbix_export:
});
}
catch (error) {
- method_error[method] = 'Failed to parse response received from device API. Check debug log for more information.';
+ method_error = 'Method: ' + method + '. Failed to parse response received from device API.';
}
}
+ else {
+ method_error = 'Method: ' + method + '. No data received by request.';
+ }
- if (Object.keys(method_error).length > 0) {
- data['errors'].push(method_error);
+ if (method_error.length > 0) {
+ data.errors.push(method_error);
}
});
+ if (data.errors.length == 0) {
+ data.errors = '';
+ }
+
response = request.get(params.base_url + 'api/exit');
if (request.getStatus() < 200 || request.getStatus() >= 300) {
diff --git a/templates/san/hpe_msa2060_http/README.md b/templates/san/hpe_msa2060_http/README.md
index 632ee342ac7..bf077ec9437 100644
--- a/templates/san/hpe_msa2060_http/README.md
+++ b/templates/san/hpe_msa2060_http/README.md
@@ -176,7 +176,7 @@ There are no template links in this template.
|Name|Description|Expression|Severity|Dependencies and additional info|
|----|-----------|----|----|----|
-|There are errors in method requests to API |<p>There are errors in method requests to API.</p> |`length(last(/HPE MSA 2060 Storage by HTTP/hpe.msa.data.errors))>2` |AVERAGE |<p>**Depends on**:</p><p>- Service is down or unavailable</p> |
+|There are errors in method requests to API |<p>There are errors in method requests to API.</p> |`length(last(/HPE MSA 2060 Storage by HTTP/hpe.msa.data.errors))>0` |AVERAGE |<p>**Depends on**:</p><p>- Service is down or unavailable</p> |
|System health is in degraded state |<p>System health is in degraded state.</p> |`last(/HPE MSA 2060 Storage by HTTP/hpe.msa.system.health)=1` |WARNING | |
|System health is in fault state |<p>System health is in fault state.</p> |`last(/HPE MSA 2060 Storage by HTTP/hpe.msa.system.health)=2` |AVERAGE | |
|System health is in unknown state |<p>System health is in unknown state.</p> |`last(/HPE MSA 2060 Storage by HTTP/hpe.msa.system.health)=3` |INFO | |
diff --git a/templates/san/hpe_msa2060_http/template_san_hpe_msa2060_http.yaml b/templates/san/hpe_msa2060_http/template_san_hpe_msa2060_http.yaml
index 63df29521df..1fc86d7826a 100644
--- a/templates/san/hpe_msa2060_http/template_san_hpe_msa2060_http.yaml
+++ b/templates/san/hpe_msa2060_http/template_san_hpe_msa2060_http.yaml
@@ -1,6 +1,6 @@
zabbix_export:
version: '6.0'
- date: '2022-05-31T14:53:27Z'
+ date: '2022-06-01T12:48:57Z'
groups:
-
uuid: 7c2cb727f85b492d88cd56e17127c64d
@@ -55,7 +55,7 @@ zabbix_export:
triggers:
-
uuid: 2133ddf10a3641d78e609948d6842687
- expression: 'length(last(/HPE MSA 2060 Storage by HTTP/hpe.msa.data.errors))>2'
+ expression: 'length(last(/HPE MSA 2060 Storage by HTTP/hpe.msa.data.errors))>0'
name: 'There are errors in method requests to API'
priority: AVERAGE
description: 'There are errors in method requests to API.'
@@ -110,12 +110,12 @@ zabbix_export:
var response, request = new HttpRequest();
request.addHeader('datatype: json');
- auth_string = sha256(params.username + '_' + params.password)
+ auth_string = sha256(params.username + '_' + params.password);
response = request.get(params.base_url + 'api/login/' + auth_string);
if (request.getStatus() < 200 || request.getStatus() >= 300) {
- throw 'Auth request failed with status code ' + request.getStatus() + ': ' + response;
+ throw 'Authentication request has failed with status code ' + request.getStatus() + ': ' + response;
}
if (response !== null) {
@@ -123,24 +123,24 @@ zabbix_export:
auth_data = JSON.parse(response);
}
catch (error) {
- throw 'Failed to parse auth response received from device API. Check debug log for more information.';
+ throw 'Failed to parse authentication response received from device API.';
}
}
session_key = auth_data['status'][0]['response'];
- request = new HttpRequest();
request.addHeader('sessionKey: ' + session_key);
- request.addHeader('datatype: json');
- data['errors'] = [];
+ data.errors = [];
methods.forEach(function (method) {
response = request.get(params.base_url + 'api/show/' + method);
- method_error = {};
+ method_error = '';
if (request.getStatus() < 200 || request.getStatus() >= 300) {
- method_error[method] = 'Request failed with status code ' + request.getStatus() + ': ' + response;;
+ method_error = 'Method: ' + method + '. Request has failed with status code ' + request.getStatus() + ': ' + response;
+ data.errors.push(method_error);
+ return;
}
if (response !== null) {
@@ -171,15 +171,22 @@ zabbix_export:
}
}
catch (error) {
- method_error[method] = 'Failed to parse response received from device API. Check debug log for more information.';
+ method_error = 'Method: ' + method + '. Failed to parse response received from device API.';
}
}
+ else {
+ method_error = 'Method: ' + method + '. No data received by request.';
+ }
- if (Object.keys(method_error).length > 0) {
- data['errors'].push(method_error);
+ if (method_error.length > 0) {
+ data.errors.push(method_error);
}
});
+ if (data.errors.length == 0) {
+ data.errors = '';
+ }
+
return JSON.stringify(data);
description: 'The JSON with result of API requests.'
timeout: '{$HPE.MSA.DATA.TIMEOUT}'