1 <%@ page import="org.ultramonkey.l7.model.*,
2 org.ultramonkey.l7.controller.*,
3 org.ultramonkey.l7.view.*, java.util.*,
4 java.text.SimpleDateFormat,java.text.NumberFormat"
5 language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
11 if (session.isNew()) {
12 MessageView error = new MessageView(41290, LogCategorySet.GUI_USER_AUTHENTICATION, Message.INVALID_SESSSION);
13 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
14 response.sendRedirect(RedirectPages.LOGIN);
21 MessageView message = (MessageView) session.getAttribute(SessionKeys.RESULT_MESSAGE);
22 String errorMessage = "";
25 String resultJudge = "success";
26 if (message != null) {
27 errorMessage = message.getMessage();
28 errorNumber = message.getErrno();
29 category = message.getCategory();
30 session.setAttribute(SessionKeys.RESULT_MESSAGE, null);
31 if ( errorNumber >= ErrNo.ERRORNUMBER )
32 resultJudge = "error";
38 MessageView commandmessage = (MessageView) session.getAttribute(SessionKeys.COMMAND_MESSAGE);
39 String commandMessage = "";
40 int commandNumber = 0;
41 String commandCategory = "";
42 String commandJudge = "success";
43 if (commandmessage != null) {
44 commandMessage = commandmessage.getMessage();
45 commandNumber = commandmessage.getErrno();
46 commandCategory = commandmessage.getCategory();
47 session.setAttribute(SessionKeys.COMMAND_MESSAGE, null);
48 if ( commandNumber >= ErrNo.ERRORNUMBER )
49 commandJudge = "error";
55 L7guiFramework framework = new L7guiFramework();
56 LogData logdata = framework.getLogData();
59 MessageView error = new MessageView(41291, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
60 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
61 response.sendRedirect(RedirectPages.LOGIN);
65 LogSet data = logdata.snmpLog;
68 MessageView error = new MessageView(41292, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
69 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
70 response.sendRedirect(RedirectPages.LOGIN);
74 Vector<LogFileData> logfiles = data.logFiles;
75 if (logfiles == null){
76 MessageView error = new MessageView(41293, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
77 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
78 response.sendRedirect(RedirectPages.LOGIN);
82 HashMap<LogData.LogCategory, LogData.LogLevel> logcategoryset = data.logLevel;
83 if (logcategoryset == null){
84 MessageView error = new MessageView(41294, LogCategorySet.GUI_LOG, Message.UNEXPECTED_ERROR);
85 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
86 response.sendRedirect(RedirectPages.LOGIN);
93 ClusterData cd = framework.getClusterData();
96 MessageView error = new MessageView(41295, LogCategorySet.GUI_IO_COMMAND, Message.CLUSTER_DATA_ERROR);
97 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
98 response.sendRedirect(RedirectPages.LOGIN);
104 String cssSeat = "l7gui_single_style.css";
105 if ( cd.self_status == ClusterStatus.ACTIVE ){
106 cssSeat = "l7gui_act_style.css";
108 else if ( cd.self_status == ClusterStatus.STANDBY ){
109 cssSeat = "l7gui_sby_style.css";
113 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
117 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
118 <meta http-equiv="Pragma" content="no-cache">
119 <meta http-equiv="Cache-Control" content="no-cache">
120 <meta http-equiv="Expires" content="0">
121 <meta http-equiv="Content-Script-Type" content="text/javascript" />
122 <meta http-equiv="Content-Style-Type" content="text/css" />
123 <script src="l7gui.js" type="text/javascript"></script>
125 <meta http-equiv="refresh" content="<%= RedirectPages.NOSCRIPT_TIME %>; url=<%= RedirectPages.LOGIN %>"/>
127 <link rel="stylesheet" type="text/css" href="<%=cssSeat %>" />
128 <link rel="shortcut icon" href="images/favicon.ico"/>
129 <title>Log - SNMPAgent -</title>
134 <body class="normal">
135 <jsp:include page="menu.jsp" flush="false"/>
138 <h1>Log - SNMPAgent -</h1>
140 if ( (message != null ) && (errorMessage != null) ) {
143 <p class="<%=resultJudge %>">[<%=category%>-<%=errorNumber%>]</p>
144 <p class="<%=resultJudge %>"><%=errorMessage%></p>
147 } else if ( (commandmessage != null) && (commandMessage != null) ) {
149 <p class="<%=commandJudge %>">[<%=commandCategory%>-<%=commandNumber%>]</p>
150 <p class="<%=commandJudge %>"><%=commandMessage%></p>
155 <h2> Download Log File</h2>
156 <h4>Please select the following list you would like to download the log file. </h4>
158 <table class="infotable" cellspacing="0">
161 <th>LogFileName</th><th>LastUpdate</th><th>FileSize(byte)</th>
165 SimpleDateFormat dfm = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
166 NumberFormat num = NumberFormat.getInstance();
167 Iterator<LogFileData> i = logfiles.iterator();
169 while ( i.hasNext() ){
170 LogFileData log = (LogFileData) i.next();
172 if ( log != null && log.fileName != null){
175 out.println("<a href=\"LogOutputServlet?type=" + LogCategorySet.SNMPAGENT + "&log=" + log.fileName + "\">" + log.fileName + "</a>");
176 out.println("</td>");
177 out.println("<td class=\"center\">" + dfm.format(log.time) + "</td>");
178 out.println("<td class=\"right\">" + num.format(log.size) + "</td>");
179 out.println("</tr>");
189 <h2>Change Log Level</h2>
190 <h4>Please select log level you would like to change.</h4>
192 <form method="post" action="LogLevelServlet" name="log_snmp">
193 <input type="hidden" name="type" value="<%=LogCategorySet.SNMPAGENT %>">
194 <table class="infotable" cellspacing="0">
197 <th>Category</th><th>Level</th>
201 TreeSet<LogData.LogCategory> tree = new TreeSet<LogData.LogCategory>(logcategoryset.keySet());
202 Iterator<LogData.LogCategory> it = tree.iterator();
204 while (it.hasNext()) {
205 LogData.LogCategory logcategory = (LogData.LogCategory) it.next();
207 if (logcategory != null){
210 <td><%= logcategory %></td>
212 <select id="<%= logcategory %>" name="<%= logcategory %>">
213 <option value="<%=LogData.LogLevel.NONE %>"<%
214 if ( logcategoryset.get(logcategory) == LogData.LogLevel.NONE)
215 out.print(" selected");
217 <option value="<%=LogData.LogLevel.DEBUG %>"<%
218 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.DEBUG)) {
219 out.print(" selected");
222 <option value="<%=LogData.LogLevel.INFO %>"<%
223 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.INFO)){
224 out.print(" selected");
227 <option value="<%=LogData.LogLevel.ERROR %>"<%
228 if (logcategoryset.get(logcategory) == (LogData.LogLevel.ERROR)){
229 out.print(" selected");
232 <option value="<%=LogData.LogLevel.WARN %>"<%
233 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.WARN)){
234 out.print(" selected");
237 <option value="<%=LogData.LogLevel.FATAL %>"<%
238 if ( logcategoryset.get(logcategory) == (LogData.LogLevel.FATAL)){
239 out.print(" selected");
252 <input type="submit" name="button" value="<%= ButtonMode.APPLY %>" onClick="return confirm(log_snmp_apply)" />
254 <input type="submit" name="button" value="<%= ButtonMode.SAVE %>" onClick="return confirm(log_snmp_save)" />
256 if (cd.self_status == ClusterStatus.ACTIVE || cd.self_status == ClusterStatus.STANDBY) {
258 <input type="submit" name="button" value="<%= ButtonMode.SAVESYNC %>" onClick="return confirm(log_snmp_savesync)" />