use of nl.nn.adapterframework.lifecycle.ApplicationMetrics in project iaf by ibissource.
the class ServerStatistics method getServerInformation.
@GET
@PermitAll
@Path("/server/info")
@Produces(MediaType.APPLICATION_JSON)
public Response getServerInformation() throws ApiException {
Map<String, Object> returnMap = new HashMap<>();
AppConstants appConstants = AppConstants.getInstance();
Map<String, Object> framework = new HashMap<>(2);
framework.put("name", "FF!");
framework.put("version", appConstants.getProperty("application.version"));
returnMap.put("framework", framework);
Map<String, Object> instance = new HashMap<>(2);
instance.put("version", appConstants.getProperty("instance.version"));
instance.put("name", getIbisContext().getApplicationName());
returnMap.put("instance", instance);
String dtapStage = appConstants.getProperty("dtap.stage");
returnMap.put("dtap.stage", dtapStage);
String dtapSide = appConstants.getProperty("dtap.side");
returnMap.put("dtap.side", dtapSide);
returnMap.put("configurations", getConfigurations());
String user = getUserPrincipalName();
if (user != null) {
returnMap.put("userName", user);
}
returnMap.put("applicationServer", servletConfig.getServletContext().getServerInfo());
returnMap.put("javaVersion", System.getProperty("java.runtime.name") + " (" + System.getProperty("java.runtime.version") + ")");
Map<String, Object> fileSystem = new HashMap<>(2);
fileSystem.put("totalSpace", Misc.getFileSystemTotalSpace());
fileSystem.put("freeSpace", Misc.getFileSystemFreeSpace());
returnMap.put("fileSystem", fileSystem);
returnMap.put("processMetrics", ProcessMetrics.toMap());
Date date = new Date();
returnMap.put("serverTime", date.getTime());
returnMap.put("machineName", Misc.getHostname());
ApplicationMetrics metrics = getIbisContext().getBean("metrics", ApplicationMetrics.class);
returnMap.put("uptime", (metrics != null) ? metrics.getUptimeDate() : "");
return Response.status(Response.Status.OK).entity(returnMap).build();
}
Aggregations