diff --git a/README.md b/README.md index 867c49a..95db00f 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,22 @@ All you need is a configuration file defining the targets to monitor. ... - - - - http://xxxxx + + + https://www.imixs.org + Imixs-Workflow supports the BPMN 2.0 standard + + + + https://foo.com/ + my-data yyy xxx - ....regex... - - + + + diff --git a/src/main/java/org/imixs/muluk/MonitorController.java b/src/main/java/org/imixs/muluk/MonitorController.java index dfe5438..32bf02e 100644 --- a/src/main/java/org/imixs/muluk/MonitorController.java +++ b/src/main/java/org/imixs/muluk/MonitorController.java @@ -46,145 +46,155 @@ @SessionScoped public class MonitorController implements Serializable { - private static final long serialVersionUID = 1L; - - private static Logger logger = Logger.getLogger(MonitorController.class.getName()); - - @Inject - MonitorService monitorService; - - public MonitorController() { - super(); - - } - - /** - * This method start the system setup during deployment - * - * @throws AccessDeniedException - */ - @PostConstruct - public void init() { - logger.info("...started"); - - logger.info("app start=" + monitorService.getStarted()); - - } - - public Date getStarted() { - return monitorService.getStarted(); - } - - /** - * Returns the object availiblity - * @return - */ - public double getAvailability() { - double pings = getConfig().getObjectPings(); - double errors = getConfig().getObjectErrors(); - double total = pings + errors; - double result = 0; - if (total > 0) { - result = pings / total * 100; - } - return result; - } - - /** - * Returns the cluster availability - */ - public double getClusterAvailability() { - double pings = getConfig().getClusterPings(); - double errors = getConfig().getClusterErrors(); - double total = pings + errors; - double result = 0; - if (total > 0) { - result = pings / total * 100; - } - return result; - } - - - /** - * Returns the objects. - * - * @return - */ - public XMLConfig getConfig() { - return monitorService.getConfig(); - } - - public String getName() { - return monitorService.getConfig().getCluster().getName(); - } - - /** - * Returns the objects. - * - * @return - */ - public XMLObject[] getObjects() { - return monitorService.getConfig().getMonitor().getObject(); - } - - public int getObjectsTotal() { - return monitorService.getConfig().getMonitor().getObject().length; - } - - public int getObjectsUp() { - int result = 0; - XMLObject[] objects = monitorService.getConfig().getMonitor().getObject(); - for (XMLObject obj : objects) { - if ("OK".equals(obj.getStatus())) { - result++; - } - } - return result; - } - - public String getUptime() { - - long different = System.currentTimeMillis() - monitorService.getStarted().getTime(); - long secondsInMilli = 1000; - long minutesInMilli = secondsInMilli * 60; - long hoursInMilli = minutesInMilli * 60; - long daysInMilli = hoursInMilli * 24; - long elapsedDays = different / daysInMilli; - different = different % daysInMilli; - - long elapsedHours = different / hoursInMilli; - different = different % hoursInMilli; - - long elapsedMinutes = different / minutesInMilli; - different = different % minutesInMilli; - - long elapsedSeconds = different / secondsInMilli; - - String uptime = ""; - - if (elapsedDays > 0) { - uptime = uptime + elapsedDays + " days, "; - } - if (elapsedHours > 0) { - uptime = uptime + elapsedHours + " hours, "; - } - - if (elapsedMinutes > 0) { - uptime = uptime + elapsedMinutes + " minutes, "; - } - - uptime = uptime + elapsedSeconds + " seconds"; - - return uptime; - - } - - public int getClusterSize() { - return monitorService.getConfig().getCluster().getNode().length; - } - - public XMLObject[] getClusterNodes() { - return monitorService.getConfig().getCluster().getNode(); - } + private static final long serialVersionUID = 1L; + + private static Logger logger = Logger.getLogger(MonitorController.class.getName()); + + @Inject + MonitorService monitorService; + + public MonitorController() { + super(); + + } + + /** + * This method start the system setup during deployment + * + * @throws AccessDeniedException + */ + @PostConstruct + public void init() { + logger.info("...started"); + + logger.info("app start=" + monitorService.getStarted()); + + } + + public Date getStarted() { + return monitorService.getStarted(); + } + + /** + * Returns the object availiblity + * + * @return + */ + public double getAvailability() { + double pings = getConfig().getObjectPings(); + double errors = getConfig().getObjectErrors(); + double total = pings + errors; + double result = 0; + if (total > 0) { + result = pings / total * 100; + } + return result; + } + + /** + * Returns the cluster availability + */ + public double getClusterAvailability() { + double pings = getConfig().getClusterPings(); + double errors = getConfig().getClusterErrors(); + double total = pings + errors; + double result = 0; + if (total > 0) { + result = pings / total * 100; + } + return result; + } + + /** + * Returns the objects. + * + * @return + */ + public XMLConfig getConfig() { + return monitorService.getConfig(); + } + + public String getName() { + return monitorService.getConfig().getCluster().getName(); + } + + /** + * Returns the objects. + * + * @return + */ + public XMLObject[] getObjects() { + return monitorService.getConfig().getMonitor().getObject(); + } + + public int getObjectsTotal() { + return monitorService.getConfig().getMonitor().getObject().length; + } + + public int getObjectsUp() { + int result = 0; + XMLObject[] objects = monitorService.getConfig().getMonitor().getObject(); + for (XMLObject obj : objects) { + if ("OK".equals(obj.getStatus())) { + result++; + } + } + return result; + } + + public String getUptime() { + + long different = System.currentTimeMillis() - monitorService.getStarted().getTime(); + long secondsInMilli = 1000; + long minutesInMilli = secondsInMilli * 60; + long hoursInMilli = minutesInMilli * 60; + long daysInMilli = hoursInMilli * 24; + long elapsedDays = different / daysInMilli; + different = different % daysInMilli; + + long elapsedHours = different / hoursInMilli; + different = different % hoursInMilli; + + long elapsedMinutes = different / minutesInMilli; + different = different % minutesInMilli; + + long elapsedSeconds = different / secondsInMilli; + + String uptime = ""; + + if (elapsedDays > 0) { + uptime = uptime + elapsedDays + " days, "; + } + if (elapsedHours > 0) { + uptime = uptime + elapsedHours + " hours, "; + } + + if (elapsedMinutes > 0) { + uptime = uptime + elapsedMinutes + " minutes, "; + } + + uptime = uptime + elapsedSeconds + " seconds"; + + return uptime; + + } + + public int getClusterSize() { + return monitorService.getConfig().getCluster().getNode().length; + } + + public int getClusterUp() { + int result = 0; + for (XMLObject obj : monitorService.getConfig().getCluster().getNode()) { + if (MonitorService.STATUS_OK.equalsIgnoreCase(obj.getStatus())) { + result++; + } + } + return result; + } + + public XMLObject[] getClusterNodes() { + return monitorService.getConfig().getCluster().getNode(); + } } diff --git a/src/main/webapp/css/dark/muluk.css b/src/main/webapp/css/dark/muluk.css index 9e106aa..20819b7 100644 --- a/src/main/webapp/css/dark/muluk.css +++ b/src/main/webapp/css/dark/muluk.css @@ -123,6 +123,8 @@ body { box-shadow: inset 0 0 0.4em yellow, 0 0 0.4em yellow; } + + .container-panel:before { border-left: 0.2em solid #ffff33; border-right: 0.2em solid #ffff33; @@ -134,6 +136,30 @@ body { color: #ffff99; } + +.container-panel.red { + border: 0.2em solid #ff3333; + box-shadow: inset 0 0 0.4em red, 0 0 0.4em red; +} +.container-panel.red:before { + border-left: 0.2em solid #ff3333; + border-right: 0.2em solid #ff3333; + color: #ff9999; + text-shadow: 0 0 0.4em red; +} + +.container-panel.green { + border: 0.2em solid #64ff47; + box-shadow: inset 0 0 0.4em #39ff14, 0 0 0.4em #39ff14; +} +.container-panel.green:before { + border-left: 0.2em solid #64ff47; + border-right: 0.2em solid #64ff47; + color: #baffad; + text-shadow: 0 0 0.4em #39ff14; +} + + .container-panel p { font-weight: bold; } diff --git a/src/main/webapp/index.xhtml b/src/main/webapp/index.xhtml index 300f82e..973b6d8 100644 --- a/src/main/webapp/index.xhtml +++ b/src/main/webapp/index.xhtml @@ -7,10 +7,7 @@ template="/layout/template.xhtml"> - - - Started: #{monitorController.started} @@ -44,24 +41,10 @@ - - - Nodes Watching: - #{monitorController.getClusterSize()}/#{monitorController.getClusterSize()} - Monitors Up - - - - Objects Watching: - #{monitorController.objectsUp}/#{monitorController.objectsTotal} Objects Up - - - - - + - + All Cluster Nodes: Availability = Total Errors = #{monitorController.config.objectErrors} - - - + + + Nodes Watching: + #{monitorController.clusterUp}/#{monitorController.clusterSize} + Monitors Up + - - - + + Objects Watching: + #{monitorController.objectsUp}/#{monitorController.objectsTotal} Objects Up + + - - #{message.application_title} - - - + + + + #{message.application_title} @@ -33,9 +33,6 @@ - - - @@ -46,8 +43,6 @@ href="#{facesContext.externalContext.requestContextPath}/css/dark/muluk.css" charset="UTF-8" type="text/css" rel="stylesheet" /> - - @@ -73,19 +68,6 @@ - - - - - - -
Started: #{monitorController.started}
Nodes Watching:
Objects Watching:
All Cluster Nodes: