summaryrefslogtreecommitdiffstats
path: root/app/common/services
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2019-05-24 14:33:56 -0500
committerGunnar Mills <gmills@us.ibm.com>2019-06-21 14:29:40 +0000
commite4194ce0dc8a941c4f30fd0995f9ba4c13cec560 (patch)
tree15887d0e4061b7dec40991f2f2fb8a590d9835af /app/common/services
parente4ae854c217344b4f35717e922083a253f43bfa0 (diff)
downloadphosphor-webui-e4194ce0dc8a941c4f30fd0995f9ba4c13cec560.tar.gz
phosphor-webui-e4194ce0dc8a941c4f30fd0995f9ba4c13cec560.zip
Add remote logging server
Remote logging enables the user to configure a remote server to stream out local logs. This feature will be available on the Event Log page. The user can add a remote server, edit/change an existing server configuration and remove/disable the remote server. Resolves openbmc/phosphor-webui#68 Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I8284cbdbdaaf85f5c95f237efc72290c66904b40
Diffstat (limited to 'app/common/services')
-rw-r--r--app/common/services/api-utils.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js
index 6e46c9c..e796f43 100644
--- a/app/common/services/api-utils.js
+++ b/app/common/services/api-utils.js
@@ -1557,6 +1557,65 @@ window.angular && (function(angular) {
});
return $q.all(promises);
},
+ setRemoteLoggingServer: (data) => {
+ const ip = data.hostname;
+ const port = data.port;
+ const setIPRequest = $http({
+ method: 'PUT',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/logging/config/remote/attr/Address',
+ withCredentials: true,
+ data: {'data': ip}
+ });
+ const setPortRequest = $http({
+ method: 'PUT',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/logging/config/remote/attr/Port',
+ withCredentials: true,
+ data: {'data': port}
+ });
+ const promises = [setIPRequest, setPortRequest];
+ return $q.all(promises);
+ },
+ getRemoteLoggingServer: () => {
+ return $http({
+ method: 'GET',
+ url: DataService.getHost() +
+ '/xyz/openbmc_project/logging/config/remote',
+ withCredentials: true
+ })
+ .then((response) => {
+ const remoteServer = response.data.data;
+ if (remoteServer === undefined) {
+ return undefined;
+ }
+ const hostname = remoteServer.Address;
+ const port = remoteServer.Port;
+ if (hostname === '') {
+ return undefined;
+ } else {
+ return {
+ hostname, port
+ }
+ }
+ });
+ },
+ disableRemoteLoggingServer: () => {
+ return SERVICE.setRemoteLoggingServer({hostname: '', port: 0});
+ },
+ updateRemoteLoggingServer: (data) => {
+ // Recommended to disable existing configuration
+ // before updating config to new server
+ // https://github.com/openbmc/phosphor-logging#changing-the-rsyslog-server
+ return SERVICE.disableRemoteLoggingServer()
+ .then(() => {
+ return SERVICE.setRemoteLoggingServer(data);
+ })
+ .catch(() => {
+ // try updating server even if initial disable attempt fails
+ return SERVICE.setRemoteLoggingServer(data);
+ });
+ },
getPowerConsumption: function() {
return $http({
method: 'GET',
OpenPOWER on IntegriCloud