Skip to content

Commit d983f36

Browse files
authored
Merge pull request #193 from Dokyeongyun/ft-220316-alertLogMonitoring
Ft 220316 alert log monitoring
2 parents edd6f8e + a374df4 commit d983f36

File tree

4 files changed

+107
-20
lines changed

4 files changed

+107
-20
lines changed

src/main/java/root/core/service/contracts/PropertyService.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.util.List;
44
import java.util.Map;
55

6+
import root.core.domain.AlertLogCommand;
67
import root.core.domain.JdbcConnectionInfo;
78
import root.core.domain.JschConnectionInfo;
89
import root.core.domain.MonitoringYN;
@@ -78,6 +79,20 @@ public interface PropertyService {
7879

7980
List<JdbcConnectionInfo> getJdbcConnInfoList(List<String> dbNames);
8081

82+
/**
83+
* 서버의 접속정보를 가져온다.
84+
*
85+
* @param serverName 서버 접속정보 별칭
86+
* @return
87+
*/
88+
JschConnectionInfo getJschConnInfo(String serverName);
89+
90+
/**
91+
* 서버들의 접속정보를 가져온다.
92+
*
93+
* @param serverNames
94+
* @return
95+
*/
8196
List<JschConnectionInfo> getJschConnInfoList(List<String> serverNames);
8297

8398
/**
@@ -140,4 +155,13 @@ public interface PropertyService {
140155
*/
141156
void saveMonitoringPresetSetting(String presetName,
142157
Map<MonitoringType, Map<String, Boolean>> settingedMonitoringYN);
158+
159+
/**
160+
* 설정된 AlertLog 모니터링 커맨드 정보를 가져온다.
161+
*
162+
* @param connInfoSetting
163+
* @param serverName
164+
* @return
165+
*/
166+
AlertLogCommand getAlertLogCommand(String connInfoSetting, String serverName);
143167
}

src/main/java/root/core/service/implement/FilePropertyService.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.apache.commons.configuration2.PropertiesConfiguration;
1313
import org.apache.commons.lang3.StringUtils;
1414

15+
import root.core.domain.AlertLogCommand;
1516
import root.core.domain.JdbcConnectionInfo;
1617
import root.core.domain.JschConnectionInfo;
1718
import root.core.domain.MonitoringYN;
@@ -174,6 +175,17 @@ public List<JdbcConnectionInfo> getJdbcConnInfoList(List<String> dbNames) {
174175
.collect(Collectors.mapping(dbName -> propRepo.getJdbcConnectionInfo(dbName), Collectors.toList()));
175176
}
176177

178+
/**
179+
* 서버의 접속정보를 가져온다.
180+
*/
181+
@Override
182+
public JschConnectionInfo getJschConnInfo(String serverName) {
183+
return propRepo.getJschConnectionInfo(serverName);
184+
}
185+
186+
/**
187+
* 서버들의 접속정보를 가져온다.
188+
*/
177189
@Override
178190
public List<JschConnectionInfo> getJschConnInfoList(List<String> serverNames) {
179191
return serverNames.stream().sorted().collect(
@@ -221,7 +233,7 @@ public void saveLastUseConnectionInfoSetting(String filePath) {
221233
rememberConfig.setProperty("filepath.config.lastuse", filePath.replace("\\", "/"));
222234
propRepo.save(rememberConfig.getString("filepath.config.remember"), rememberConfig);
223235
}
224-
236+
225237
/**
226238
* 접속정보 설정을 추가한다.
227239
*/
@@ -269,4 +281,10 @@ public void saveMonitoringPresetSetting(String presetName,
269281
propRepo.loadMonitoringInfoConfig(monitoringFilePath);
270282
}
271283
}
284+
285+
@Override
286+
public AlertLogCommand getAlertLogCommand(String connInfoSetting, String serverName) {
287+
loadConnectionInfoConfig(connInfoSetting);
288+
return propRepo.getAlertLogCommand(serverName);
289+
}
272290
}

src/main/java/root/javafx/Controller/HistoryMenuController.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import root.common.server.implement.JschServer;
2121
import root.core.domain.ASMDiskUsage;
2222
import root.core.domain.AlertLog;
23+
import root.core.domain.AlertLogCommandPeriod;
2324
import root.core.domain.ArchiveUsage;
2425
import root.core.domain.JdbcConnectionInfo;
2526
import root.core.domain.JschConnectionInfo;
@@ -57,22 +58,22 @@ public class HistoryMenuController implements Initializable {
5758

5859
@FXML
5960
DatePicker alertLogStartDayDP;
60-
61+
6162
@FXML
6263
DatePicker alertLogEndDayDP;
6364

6465
@FXML
6566
AnchorPane archiveUsageTabAP;
66-
67+
6768
@FXML
6869
AnchorPane tableSpaceUsageTabAP;
69-
70+
7071
@FXML
7172
AnchorPane asmDiskUsageTabAP;
72-
73+
7374
@FXML
7475
AnchorPane osDiskUsageTabAP;
75-
76+
7677
@FXML
7778
AnchorPane alertLogUsageTabAP;
7879

@@ -282,4 +283,21 @@ private boolean validateInput() {
282283
return true;
283284
}
284285

286+
public void monitoringAlertLog(ActionEvent e) {
287+
String alertLogStartDay = alertLogStartDayDP.getValue().toString();
288+
String alertLogEndDay = alertLogEndDayDP.getValue().toString();
289+
290+
String selectedServer = alertLogServerComboBox.getSelectionModel().getSelectedItem();
291+
JschConnectionInfo connInfo = propService.getJschConnInfo(selectedServer);
292+
293+
JschServer server = new JschServer(connInfo);
294+
server.init();
295+
ServerCheckRepository repo = new ServerCheckRepositoryImpl(server);
296+
ServerCheckUsecase usecase = new ServerCheckUsecaseImpl(repo, ReportFileRepo.getInstance());
297+
298+
AlertLogCommandPeriod alcp = new AlertLogCommandPeriod(connInfo.getAlc(), alertLogStartDay, alertLogEndDay);
299+
alertLogMonitoringResultMap.put(selectedServer, usecase.getAlertLogDuringPeriod(alcp));
300+
301+
changeAlertLogListViewData(alertLogServerComboBox.getSelectionModel().getSelectedItem());
302+
}
285303
}

src/main/resources/fxml/HistoryMenu.fxml

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,57 @@
101101
<children>
102102
<ToolBar nodeOrientation="LEFT_TO_RIGHT" style="-fx-background-color: #ffffff00;" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
103103
<items>
104-
<Label text="Remote Server선택">
104+
<Label fx:id="label" minHeight="20.0" text="Server 선택">
105+
<padding>
106+
<Insets right="10.0" />
107+
</padding>
105108
<styleClass>
106109
<String fx:value="basic-font" />
107110
<String fx:value="bold" />
108111
</styleClass>
109-
<padding>
110-
<Insets right="10.0" />
111-
</padding>
112112
</Label>
113113
<JFXComboBox fx:id="alertLogServerComboBox" maxHeight="25.0" minHeight="25.0" minWidth="150.0" styleClass="basic-font" stylesheets="@../css/javaFx.css" unFocusColor="#ececec" />
114-
<Button mnemonicParsing="false" styleClass="basic-font" text="조회" />
115-
<Button mnemonicParsing="false" styleClass="basic-font" text="새로고침" />
116-
<Button mnemonicParsing="false" styleClass="basic-font" text="엑셀출력" />
117-
<Button mnemonicParsing="false" styleClass="basic-font" text="그래프보기" />
114+
<JFXButton ellipsisString="" minHeight="20.0" onAction="#monitoringAlertLog" styleClass="basic-font" text="조회">
115+
<graphic>
116+
<FontAwesomeIconView fill="#01077dc7" glyphName="PLAY_CIRCLE" size="18">
117+
<cursor>
118+
<Cursor fx:constant="HAND" />
119+
</cursor>
120+
</FontAwesomeIconView>
121+
</graphic>
122+
</JFXButton>
118123
</items>
119124
</ToolBar>
120125
<Separator AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
121126
</children>
122127
</AnchorPane>
123-
<AnchorPane style="-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 10, 0, 0, 0); -fx-border-color: #e1e1e1; -fx-border-width: 0.5px; -fx-background-color: white;" AnchorPane.bottomAnchor="125.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="50.0">
124-
<children>
125-
<JFXListView fx:id="alertLogLV" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
126-
</children>
127-
</AnchorPane>
128+
<SplitPane dividerPositions="0.8" layoutX="1.0" layoutY="41.0" style="-fx-effect: dropshadow(three-pass-box, rgba(0,0,0,0.5), 10, 0, 0, 0);" AnchorPane.bottomAnchor="125.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="50.0">
129+
<items>
130+
<JFXListView fx:id="alertLogLV" style="-fx-background-color: white;" />
131+
<TabPane minWidth="150.0" tabMaxWidth="60.0">
132+
<tabs>
133+
<Tab closable="false" text="Overview">
134+
<content>
135+
<AnchorPane>
136+
<children>
137+
<JFXListView fx:id="alertLogOverviewLV" style="-fx-background-color: white;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
138+
</children>
139+
</AnchorPane>
140+
</content>
141+
</Tab>
142+
<Tab closable="false" text="Error Docs">
143+
<content>
144+
<AnchorPane>
145+
<children>
146+
<JFXListView style="-fx-background-color: white;" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
147+
</children>
148+
</AnchorPane>
149+
</content>
150+
</Tab>
151+
</tabs>
152+
</TabPane>
153+
</items>
154+
</SplitPane>
128155
<AnchorPane layoutX="204.0" layoutY="317.0" maxHeight="150.0" minHeight="150.0" prefHeight="150.0" AnchorPane.bottomAnchor="5.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0">
129156
<children>
130157
<AnchorPane maxWidth="400.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="0.0">
@@ -225,7 +252,7 @@
225252
<Separator prefWidth="200.0" AnchorPane.bottomAnchor="108.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" />
226253
</children>
227254
<padding>
228-
<Insets bottom="10.0" left="10.0" right="10.0" />
255+
<Insets bottom="10.0" left="5.0" right="5.0" />
229256
</padding>
230257
</AnchorPane>
231258
</content>

0 commit comments

Comments
 (0)