This repository was archived by the owner on Sep 2, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +21
-9
lines changed
docker-monitoring-eparest
src/main/java/com/ca/docker Expand file tree Collapse file tree 4 files changed +21
-9
lines changed Original file line number Diff line number Diff line change 128128 <Panel layout="BorderLayout" title="Overview"> -->
129129 <Panel border =" Etched" constraint =" North" layout =" GridLayout" rows =" 1" >
130130 <Panel layout =" GridLayout" rows =" 2" >
131+ <LiveMetricValueLabel relative-metric =" :Last Update Time" >
132+ <Title its : translate =" yes" >Last Update Time: </Title >
133+ </LiveMetricValueLabel >
131134 <LiveMetricValueLabel relative-metric =" :Name" >
132135 <Title its : translate =" yes" >Host Name: </Title >
133136 </LiveMetricValueLabel >
134137
135- <LiveMetricValueLabel relative-metric =" :DockerRootDir" >
136- <Title its : translate =" yes" >Docker Root Directory: </Title >
137- </LiveMetricValueLabel >
138+
138139
139140 <LiveMetricValueLabel relative-metric =" :KernelVersion" >
140141 <Title its : translate =" yes" >Kernel Version: </Title >
158159 <LiveMetricValueLabel relative-metric =" :Total Memory" >
159160 <Title its : translate =" yes" >Total Memory (in MB): </Title >
160161 </LiveMetricValueLabel >
162+
161163 </Panel >
162164 </Panel >
163165 <Panel layout =" GridLayout" rows =" 2" >
Original file line number Diff line number Diff line change 11package com .ca .docker ;
22
3- import java .math .BigInteger ;
4- import java .util .Date ;
53import java .util .HashMap ;
64import java .util .List ;
75
Original file line number Diff line number Diff line change 99import java .net .HttpURLConnection ;
1010import java .net .URL ;
1111import java .text .DecimalFormat ;
12+ import java .text .SimpleDateFormat ;
1213import java .util .ArrayList ;
1314import java .util .Date ;
1415import java .util .Iterator ;
@@ -342,7 +343,7 @@ private ArrayList<Container> readContainerInfoJsonFromUrl(String relativePath)
342343 lcs .add (cse );
343344 }
344345 // Containers page = gson.fromJson(json, Containers.class);
345- hostInfo .updateContainerInfo (upContainer , downContainer );
346+ hostInfo .updateContainerInfo (upContainer , downContainer , getCurrentTime () );
346347 return lcs ;
347348 } catch (Exception e )
348349 {
@@ -352,6 +353,18 @@ private ArrayList<Container> readContainerInfoJsonFromUrl(String relativePath)
352353 return null ;
353354
354355 }
356+ /**
357+ *
358+ * @return a String showing current local time
359+ */
360+ private String getCurrentTime ()
361+ {
362+ // TODO Auto-generated method stub
363+ Date date = new Date ();
364+ SimpleDateFormat sdf ;
365+ sdf = new SimpleDateFormat ("dd MMM yyyy hh:mm:ss a zzz" );
366+ return sdf .format (date );
367+ }
355368
356369 /**
357370 * Populate the container raw data inside ContainerStatInfo
Original file line number Diff line number Diff line change @@ -67,13 +67,12 @@ public class HostInfo
6767
6868 private HashMap <String , Comparable <?>> hostInfo ;
6969
70- private int upContainer ;
71- private int downContainer ;
7270
73- public void updateContainerInfo (int a , int b )
71+ public void updateContainerInfo (int a , int b , String lastUpdateTime )
7472 {
7573 hostInfo .put ("Running Container" , a );
7674 hostInfo .put ("Stopped Container" , b );
75+ hostInfo .put ("Last Update Time" , (String )lastUpdateTime );
7776 }
7877
7978 public void populateMetricData (HostInfo c )
You can’t perform that action at this time.
0 commit comments