Search in sources :

Example 1 with ApplicationMetrics

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();
}
Also used : HashMap(java.util.HashMap) ApplicationMetrics(nl.nn.adapterframework.lifecycle.ApplicationMetrics) Date(java.util.Date) AppConstants(nl.nn.adapterframework.util.AppConstants) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) PermitAll(javax.annotation.security.PermitAll)

Aggregations

Date (java.util.Date)1 HashMap (java.util.HashMap)1 PermitAll (javax.annotation.security.PermitAll)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 ApplicationMetrics (nl.nn.adapterframework.lifecycle.ApplicationMetrics)1 AppConstants (nl.nn.adapterframework.util.AppConstants)1