Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 9b91c23

Browse files
committed
Adding Last Update Time
1 parent 1776394 commit 9b91c23

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

docker-monitoring-eparest/docker.typeviewers.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,14 @@
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>
@@ -158,6 +159,7 @@
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">

docker-monitoring-eparest/src/main/java/com/ca/docker/Container.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package com.ca.docker;
22

3-
import java.math.BigInteger;
4-
import java.util.Date;
53
import java.util.HashMap;
64
import java.util.List;
75

docker-monitoring-eparest/src/main/java/com/ca/docker/DataPoller.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import java.net.HttpURLConnection;
1010
import java.net.URL;
1111
import java.text.DecimalFormat;
12+
import java.text.SimpleDateFormat;
1213
import java.util.ArrayList;
1314
import java.util.Date;
1415
import 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

docker-monitoring-eparest/src/main/java/com/ca/docker/HostInfo.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)