`
gary0416
  • 浏览: 334694 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

web服务器监控(一)

阅读更多

程序截图


原理

定时任务,通过与监控URL建立连接来判断web服务器状态,如果异常,发送邮件通知,如果是139邮箱,同时可接收到手机短信.最终发布时使用fatjar打包,通过one-jar可以将lib打包到一个jar文件中.

 

源码

ServerMonitor

 

package com.gary.ui;

/**
 * 主程序
 * @author gary
 */
public class ServerMonitor {
    public static void main(String[] args){
        MainApp frame = new MainApp();
        frame.setVisible(true);
    }
}

 MainApp

 

package com.gary.ui;

import com.gary.util.ConsoleUtil;
import com.gary.util.MailUtil;
import com.gary.util.StringUtil;
import com.gary.util.SwingUtil;
import com.gary.util.TimeUtil;
import com.gary.util.URLUtil;
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.SystemTray;
import java.awt.Toolkit;
import java.awt.TrayIcon;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.IOException;
import java.net.ConnectException;
import java.net.MalformedURLException;
import java.util.Timer;
import java.util.TimerTask;
import javax.imageio.ImageIO;

/**
 * 主界面
 * @author gary
 */
public class MainApp extends javax.swing.JFrame {
    
	private static final long serialVersionUID = 1L;

	//在IDE中调试为false,发布jar包设置为true
	private boolean isPublish = false;
	
	public MainApp() {
        initComponents();
        
        if(isPublish){
        	ICO = "/computer.png";
        }else{
        	ICO = "computer.png";
        }
        
        //系统托盘图标
        systemTray = SystemTray.getSystemTray();
        try {
        	if(isPublish){
        		trayIcon = new TrayIcon(ImageIO.read(getClass().getResource(ICO)));
        	}else{
        		trayIcon = new TrayIcon(ImageIO.read(new File(ICO)));
        	}
            systemTray.add(trayIcon);
        } catch (IOException e1) {
            writeToConsole(e1.getMessage());
        } catch (AWTException e2) {
            writeToConsole(e2.getMessage());
        }

        addWindowListener(new WindowAdapter() {
            @Override
            public void windowIconified(WindowEvent e) {
                // 窗口最小化时dispose该窗口
                dispose();
            }
        });

        trayIcon.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                // 单击托盘窗口再现
                if (e.getClickCount() == 1)
                    setExtendedState(Frame.NORMAL);
                setVisible(true);
            }
        });
        
        try {
        	if(isPublish){
        		setIconImage(ImageIO.read(getClass().getResource(ICO)));
        	}else{
        		setIconImage(ImageIO.read(new java.io.File(ICO)));
        	}
        } catch (IOException e) {
            writeToConsole(e.getMessage());
        }

        //获取屏幕尺寸对象
        Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();

        //水平位置
        int w = (screen.width - width) / 2;
        //垂直位置
        int h = (screen.height - height) / 2;

        setLocation(w,h);
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Service Monitor");
        setSize(width, height);
        writeToConsole("初始化成功");
    }
    
    /**
     * 输出到控制台
     */
    private void writeToConsole(String str){
        ConsoleUtil.write(str);
        consoleText.setText(ConsoleUtil.get());
    }

    /**
     * 初始化
     */
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        userNameLabel = new javax.swing.JLabel();
        smtpText = new javax.swing.JTextField();
        smtpLabel = new javax.swing.JLabel();
        userNameText = new javax.swing.JTextField();
        passwordLabel = new javax.swing.JLabel();
        passwordText = new javax.swing.JPasswordField();
        senderLabel = new javax.swing.JLabel();
        receiverLabel = new javax.swing.JLabel();
        senderText = new javax.swing.JTextField();
        mondayText = new javax.swing.JTextField();
        mailSubjectLabel = new javax.swing.JLabel();
        mailContextLabel = new javax.swing.JLabel();
        mailSubjectText = new javax.swing.JTextField();
        mailContextPane1 = new javax.swing.JScrollPane();
        mailContentText = new javax.swing.JTextArea();
        urlText = new javax.swing.JTextField();
        urlLabel = new javax.swing.JLabel();
        controlButton = new javax.swing.JButton();
        intervalText = new javax.swing.JTextField();
        intervalLabel = new javax.swing.JLabel();
        unitLabel = new javax.swing.JLabel();
        consolePane = new javax.swing.JScrollPane();
        consoleText = new javax.swing.JTextArea();
        clearConsoleButton = new javax.swing.JButton();
        mondayLabel = new javax.swing.JLabel();
        tuesdayLabel = new javax.swing.JLabel();
        wednesdayLabel = new javax.swing.JLabel();
        thursdayLabel = new javax.swing.JLabel();
        fridayLabel = new javax.swing.JLabel();
        saturdayLabel = new javax.swing.JLabel();
        sundayLabel = new javax.swing.JLabel();
        tuesdayText = new javax.swing.JTextField();
        wednesdayText = new javax.swing.JTextField();
        thursdayText = new javax.swing.JTextField();
        fridayText = new javax.swing.JTextField();
        saturdayText = new javax.swing.JTextField();
        sundayText = new javax.swing.JTextField();
        menuBar1 = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        sendTestMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        userNameLabel.setFont(new java.awt.Font("宋体", 0, 12));
        userNameLabel.setText("用户名");
        jPanel1.add(userNameLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 40, -1, -1));

        smtpText.setFont(new java.awt.Font("宋体", 0, 12));
        smtpText.setText("mail.nou.com.cn");
        jPanel1.add(smtpText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 10, 150, -1));

        smtpLabel.setFont(new java.awt.Font("宋体", 0, 12));
        smtpLabel.setText("SMTP服务器");
        jPanel1.add(smtpLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 10, -1, -1));

        userNameText.setFont(new java.awt.Font("宋体", 0, 12));
        userNameText.setText("");
        jPanel1.add(userNameText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 40, 150, -1));

        passwordLabel.setFont(new java.awt.Font("宋体", 0, 12));
        passwordLabel.setText("密码");
        jPanel1.add(passwordLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 70, -1, -1));

        passwordText.setFont(new java.awt.Font("宋体", 0, 12));
        passwordText.setText("");
        jPanel1.add(passwordText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 70, 150, -1));

        senderLabel.setFont(new java.awt.Font("宋体", 0, 12));
        senderLabel.setText("发件人");
        jPanel1.add(senderLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 100, -1, -1));

        receiverLabel.setFont(new java.awt.Font("宋体", 0, 12));
        receiverLabel.setText("收件人");
        jPanel1.add(receiverLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 130, -1, -1));

        senderText.setFont(new java.awt.Font("宋体", 0, 12));
        senderText.setText("zhangtongbo08@nou.com.cn");
        jPanel1.add(senderText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 100, 150, -1));

        mondayText.setFont(new java.awt.Font("宋体", 0, 12));
        mondayText.setText("15842634428@139.com");
        mondayText.setToolTipText("多个收件人用;间隔");
        jPanel1.add(mondayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 160, 150, -1));

        mailSubjectLabel.setFont(new java.awt.Font("宋体", 0, 12));
        mailSubjectLabel.setText("邮件主题");
        jPanel1.add(mailSubjectLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 440, -1, -1));

        mailContextLabel.setFont(new java.awt.Font("宋体", 0, 12));
        mailContextLabel.setText("邮件内容");
        jPanel1.add(mailContextLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 470, -1, -1));

        mailSubjectText.setFont(new java.awt.Font("宋体", 0, 12));
        mailSubjectText.setText("服务器已关闭");
        jPanel1.add(mailSubjectText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 440, 150, -1));

        mailContentText.setColumns(20);
        mailContentText.setFont(new java.awt.Font("宋体", 0, 12));
        mailContentText.setRows(5);
        mailContentText.setText("目标服务器已关闭");
        mailContextPane1.setViewportView(mailContentText);

        jPanel1.add(mailContextPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 470, 250, 100));

        urlText.setFont(new java.awt.Font("宋体", 0, 12));
        urlText.setText("http://www.baidu.com/");
        jPanel1.add(urlText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 380, 150, -1));

        urlLabel.setFont(new java.awt.Font("宋体", 0, 12));
        urlLabel.setText("监控URL");
        jPanel1.add(urlLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 380, -1, -1));

        controlButton.setFont(new java.awt.Font("宋体", 0, 12));
        controlButton.setText("开始监控");
        controlButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                controlButtonActionPerformed(evt);
            }
        });
        jPanel1.add(controlButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 580, -1, -1));

        intervalText.setFont(new java.awt.Font("宋体", 0, 12));
        intervalText.setText("10");
        jPanel1.add(intervalText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 410, 70, -1));

        intervalLabel.setFont(new java.awt.Font("宋体", 0, 12));
        intervalLabel.setText("监控间隔");
        jPanel1.add(intervalLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 410, -1, -1));

        unitLabel.setFont(new java.awt.Font("宋体", 0, 12));
        unitLabel.setText("分钟");
        jPanel1.add(unitLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 410, -1, -1));

        consoleText.setColumns(20);
        consoleText.setFont(new java.awt.Font("宋体", 0, 12));
        consoleText.setRows(5);
        consolePane.setViewportView(consoleText);

        jPanel1.add(consolePane, new org.netbeans.lib.awtextra.AbsoluteConstraints(390, 10, 240, 560));

        clearConsoleButton.setFont(new java.awt.Font("宋体", 0, 12));
        clearConsoleButton.setText("清空日志");
        clearConsoleButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                clearConsoleButtonActionPerformed(evt);
            }
        });
        jPanel1.add(clearConsoleButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 580, -1, -1));

        mondayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        mondayLabel.setText("星期一");
        jPanel1.add(mondayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 160, -1, -1));

        tuesdayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        tuesdayLabel.setText("星期二");
        jPanel1.add(tuesdayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 190, -1, -1));

        wednesdayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        wednesdayLabel.setText("星期三");
        jPanel1.add(wednesdayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 220, -1, -1));

        thursdayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        thursdayLabel.setText("星期四");
        jPanel1.add(thursdayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 250, -1, -1));

        fridayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        fridayLabel.setText("星期五");
        jPanel1.add(fridayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 280, -1, -1));

        saturdayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        saturdayLabel.setText("星期六");
        jPanel1.add(saturdayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 310, -1, -1));

        sundayLabel.setFont(new java.awt.Font("宋体", 0, 12));
        sundayLabel.setText("星期日");
        jPanel1.add(sundayLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 340, -1, -1));

        tuesdayText.setFont(new java.awt.Font("宋体", 0, 12));
        tuesdayText.setText("15842634428@139.com");
        jPanel1.add(tuesdayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 190, 150, -1));

        wednesdayText.setFont(new java.awt.Font("宋体", 0, 12));
        wednesdayText.setText("15842634428@139.com");
        jPanel1.add(wednesdayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 220, 150, -1));

        thursdayText.setFont(new java.awt.Font("宋体", 0, 12));
        thursdayText.setText("15842634428@139.com");
        jPanel1.add(thursdayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 250, 150, -1));

        fridayText.setFont(new java.awt.Font("宋体", 0, 12));
        fridayText.setText("15842634428@139.com");
        jPanel1.add(fridayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 280, 150, -1));

        saturdayText.setFont(new java.awt.Font("宋体", 0, 12));
        saturdayText.setText("15842634428@139.com");
        jPanel1.add(saturdayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 310, 150, -1));

        sundayText.setFont(new java.awt.Font("宋体", 0, 12));
        sundayText.setText("15842634428@139.com");
        jPanel1.add(sundayText, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 340, 150, -1));

        getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 650, 610));

        fileMenu.setText("文件");
        fileMenu.setFont(new java.awt.Font("宋体", 0, 12));

        sendTestMenuItem.setFont(new java.awt.Font("宋体", 0, 12));
        sendTestMenuItem.setText("发送测试邮件");
        sendTestMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                sendTestMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(sendTestMenuItem);

        exitMenuItem.setFont(new java.awt.Font("宋体", 0, 12));
        exitMenuItem.setText("退出");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar1.add(fileMenu);

        helpMenu.setText("帮助");
        helpMenu.setFont(new java.awt.Font("宋体", 0, 12));

        aboutMenuItem.setFont(new java.awt.Font("宋体", 0, 12));
        aboutMenuItem.setText("关于");
        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(aboutMenuItem);

        menuBar1.add(helpMenu);

        setJMenuBar(menuBar1);

        pack();
    }

    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                              
        SwingUtil.show(new AboutDialog(this, false));
    }                                             

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                             
        System.exit(0);
    }                                            

    private void sendTestMenuItemActionPerformed(java.awt.event.ActionEvent evt) {                                                 
        try {
            new MailUtil(smtpText.getText(), userNameText.getText(), getPassword())
                                .sendSimpleMail(senderText.getText(), getReceiver(), 
                                mailSubjectText.getText(), mailContentText.getText());
            writeToConsole("测试邮件发送成功");
        }catch(Exception e){
            writeToConsole("发送邮件失败," + e.getMessage()); 
        }
    }                                                

    private void controlButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
        if(verifyParam()){
            start();
        }
    }                                             

    private void clearConsoleButtonActionPerformed(java.awt.event.ActionEvent evt) {                                                   
        ConsoleUtil.clear();
        consoleText.setText(ConsoleUtil.get());
    }                                                  

    
    public String[] getReceiver(){
        int dayOfWeek = TimeUtil.getDayOfWeek();
        switch(dayOfWeek){
            case 1:
                return sundayText.getText().split(";");
            case 2:
                return mondayText.getText().split(";");
            case 3:
                return tuesdayText.getText().split(";");
            case 4:
                return wednesdayText.getText().split(";");
            case 5:
                return thursdayText.getText().split(";");
            case 6:
                return fridayText.getText().split(";");
            case 7:
                return saturdayText.getText().split(";");
        }
        return null;
    }
    
    /**
     * 开始
     */
    public void start(){
        Double intervalDouble = Double.parseDouble(intervalText.getText());
        intervalDouble  = intervalDouble * 60 * 1000;
        long interval = (long)intervalDouble.longValue();
        Timer timer = new Timer();
        //在0秒后执行此任务,每次间隔interval秒
        //如果传递一个Data参数,就可以在某个固定的时间执行这个任务.
        timer.schedule(new MyTask(), 0, interval);
    }
    
    /**
     * 检查参数
     * @return 
     */
    private boolean verifyParam(){
        if(StringUtil.isBlank(smtpText.getText())){
            writeToConsole("SMTP服务器不能为空");
            return false;
        }
        if(StringUtil.isBlank(userNameText.getText())){
            writeToConsole("用户名不能为空");
            return false;
        }
        if(StringUtil.isBlank(getPassword())){
            writeToConsole("密码不能为空");
            return false;
        }
        if(StringUtil.isBlank(senderText.getText())){
            writeToConsole("发件人错误");
            return false;
        }
        if(StringUtil.isBlank(mondayText.getText())){
            writeToConsole("收件不能为空");
            return false;
        }
        if(StringUtil.isBlank(urlText.getText())){
            writeToConsole("URL不能为空");
            return false;
        }
        if(StringUtil.isBlank(intervalText.getText())){
            writeToConsole("监控间隔不能为空");
            return false;
        }else{
            char[] charArray = intervalText.getText().toCharArray();
            for(int i = 0 ; i < charArray.length ; i++){
                if(Character.isDigit(charArray[i]) || charArray[i] == '.'){
                }else{
                    writeToConsole("监控间隔必须为数字");
                    return false;
                }
            }
        }
        if(StringUtil.isBlank(mailSubjectText.getText())){
            writeToConsole("邮件主题不能为空");
            return false;
        }
        if(StringUtil.isBlank(mailContentText.getText())){
            writeToConsole("邮件内容不能为空");
            return false;
        }
        return true;
    }
    
    
    /**
     * 获取密码
     * @return 
     */
    private String getPassword(){
        StringBuilder password = new StringBuilder();
        char[] pass = passwordText.getPassword();
        for(int i = 0 ; i < pass.length ; i++){
            password.append(pass[i]);
        }
        return password.toString();
    }

    /**
     * 监控
     */
    private class MyTask extends TimerTask{
        @Override
        public void run() {
            try {
                new URLUtil().connect(urlText.getText());
                writeToConsole("服务器状态正常");
            } catch (MalformedURLException ex) {
                writeToConsole("URL填写错误");
            } catch (ConnectException e){
                writeToConsole("服务器已关闭");
                try {
                    new MailUtil(smtpText.getText(), userNameText.getText(), getPassword())
                            .sendSimpleMail(senderText.getText(), getReceiver(), 
                                mailSubjectText.getText(), mailContentText.getText());
                } catch (Exception ex) {
                    writeToConsole("发送邮件失败," + ex.getMessage());
                }
            } catch (IOException ex) {
                writeToConsole("连接错误");
            }
        }
    }
    
    private SystemTray systemTray;
    private TrayIcon trayIcon;
    private static final int width = 672;
    private static final int height = 667;
    private static String ICO = null;
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JButton clearConsoleButton;
    private javax.swing.JScrollPane consolePane;
    private javax.swing.JTextArea consoleText;
    private javax.swing.JButton controlButton;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JLabel fridayLabel;
    private javax.swing.JTextField fridayText;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JLabel intervalLabel;
    private javax.swing.JTextField intervalText;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JTextArea mailContentText;
    private javax.swing.JLabel mailContextLabel;
    private javax.swing.JScrollPane mailContextPane1;
    private javax.swing.JLabel mailSubjectLabel;
    private javax.swing.JTextField mailSubjectText;
    private javax.swing.JMenuBar menuBar1;
    private javax.swing.JLabel mondayLabel;
    private javax.swing.JTextField mondayText;
    private javax.swing.JLabel passwordLabel;
    private javax.swing.JPasswordField passwordText;
    private javax.swing.JLabel receiverLabel;
    private javax.swing.JLabel saturdayLabel;
    private javax.swing.JTextField saturdayText;
    private javax.swing.JMenuItem sendTestMenuItem;
    private javax.swing.JLabel senderLabel;
    private javax.swing.JTextField senderText;
    private javax.swing.JLabel smtpLabel;
    private javax.swing.JTextField smtpText;
    private javax.swing.JLabel sundayLabel;
    private javax.swing.JTextField sundayText;
    private javax.swing.JLabel thursdayLabel;
    private javax.swing.JTextField thursdayText;
    private javax.swing.JLabel tuesdayLabel;
    private javax.swing.JTextField tuesdayText;
    private javax.swing.JLabel unitLabel;
    private javax.swing.JLabel urlLabel;
    private javax.swing.JTextField urlText;
    private javax.swing.JLabel userNameLabel;
    private javax.swing.JTextField userNameText;
    private javax.swing.JLabel wednesdayLabel;
    private javax.swing.JTextField wednesdayText;
}

 AboutDialog

 

package com.gary.ui;

/**
 * 关于
 * @author gary
 */
public class AboutDialog extends javax.swing.JDialog {

	private static final long serialVersionUID = 1L;

	public AboutDialog(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
    }

    private void initComponents() {
        closeButton = new javax.swing.JButton();
        titleLabel = new javax.swing.JLabel();
        qqContentLabel = new javax.swing.JLabel();
        qqlabel = new javax.swing.JLabel();
        blogLabel = new javax.swing.JLabel();
        authorContentLabel = new javax.swing.JLabel();
        emailLabel = new javax.swing.JLabel();
        blogContentLabel = new javax.swing.JLabel();
        authorLabel = new javax.swing.JLabel();
        emailContentLabel = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Server Monitor");

        closeButton.setText("close");
        closeButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                closeButtonActionPerformed(evt);
            }
        });

        titleLabel.setText("Server Monitor V1.0");

        qqContentLabel.setText("408036296");

        qqlabel.setFont(new java.awt.Font("宋体", 1, 12));
        qqlabel.setText("QQ:");

        blogLabel.setFont(new java.awt.Font("宋体", 1, 12));
        blogLabel.setText("Blog:");

        authorContentLabel.setText("gary");

        emailLabel.setFont(new java.awt.Font("宋体", 1, 12));
        emailLabel.setText("E-mail:");

        blogContentLabel.setText("http://gary0416.iteye.com/");

        authorLabel.setFont(new java.awt.Font("宋体", 1, 12));
        authorLabel.setText("Author:");

        emailContentLabel.setText("408036296@163.com");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addComponent(titleLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(authorLabel)
                        .addGap(11, 11, 11)
                        .addComponent(authorContentLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(blogLabel)
                        .addGap(25, 25, 25)
                        .addComponent(blogContentLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(emailLabel)
                        .addGap(11, 11, 11)
                        .addComponent(emailContentLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(qqlabel)
                        .addGap(39, 39, 39)
                        .addComponent(qqContentLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(80, 80, 80)
                        .addComponent(closeButton)))
                .addContainerGap(14, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addComponent(titleLabel)
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(authorLabel)
                    .addComponent(authorContentLabel))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(blogLabel)
                    .addComponent(blogContentLabel))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(emailLabel)
                    .addComponent(emailContentLabel))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(qqlabel)
                    .addComponent(qqContentLabel))
                .addGap(25, 25, 25)
                .addComponent(closeButton)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        pack();
    }

    private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {
        this.setVisible(false);
    }

    private javax.swing.JLabel authorContentLabel;
    private javax.swing.JLabel authorLabel;
    private javax.swing.JLabel blogContentLabel;
    private javax.swing.JLabel blogLabel;
    private javax.swing.JButton closeButton;
    private javax.swing.JLabel emailContentLabel;
    private javax.swing.JLabel emailLabel;
    private javax.swing.JLabel qqContentLabel;
    private javax.swing.JLabel qqlabel;
    private javax.swing.JLabel titleLabel;
}
  • 大小: 64.7 KB
分享到:
评论

相关推荐

    WEB服务器运行状况监控

    搜藏了很久的web服务器监控程序,设定每隔一段时间访问一下网站,如果访问不到,就会发出报警。网站管理很有用的

    WEB服务器运行状况监控 v2.1

    一、服务器监控的重要性 1. 预防故障:通过持续监控,能及时发现服务器潜在的性能瓶颈,避免因资源耗尽而导致的服务中断。 2. 性能优化:实时查看服务器负载,可以调整系统配置,提高服务器处理能力,提升用户体验...

    web服务器监控器

    "Web服务器监控器"是一款专为管理和维护网络服务器设计的重要工具。它提供了实时监控、预警以及远程重启等关键功能,确保服务器的稳定运行并及时处理可能出现的问题。在现代的IT环境中,服务器监控对于企业的运营至...

    Falcon-Web服务器文件监控平台 0.1.1.zip

    Falcon是一款基于inotify-tools开发的Web服务器文件监控平台,能够实时监控Web目录文件变化(新增,修改,删除),判断文件内容是否包含恶意代码,自动隔离常见Webshell,保证Web目录文件安全。 Falcon 0.1.1 更新...

    WEB服务器运行状况监控V1.6

    【WEB服务器运行状况监控V1.6】是一款专为管理员设计的高效且免费的Web服务器监控软件,旨在确保Web服务的稳定性和安全性。这款工具具备防止病毒篡改主页以及自动恢复主页的功能,对于IIS(Internet Information ...

    JavaMelody JAVA Web项目服务器性能监控工具

    JavaMelody是一款强大的JAVA Web项目服务器性能监控工具,它能够实时、全面地监控应用程序的运行状态,帮助开发者和运维人员了解系统性能瓶颈,及时发现并解决问题。通过在Java Web应用中简单集成,JavaMelody就能...

    公司要求实时监控服务器,写个Web的监控系统

    在IT行业中,实时服务器监控是运维工作的重要环节,它能够帮助我们及时发现并解决系统问题,确保服务的稳定运行。为了满足公司的需求,构建一个基于Web的监控系统是非常必要的。这个系统应该具备实时数据采集、可视...

    基于嵌入式Web服务器的远程视频监控系统

    基于嵌入式Web服务器的远程视频监控系统,希望对家加有所帮助

    Falcon-Web服务器文件监控平台 v0.1.1.zip

    Falcon是一款基于inotify-tools开发的Web服务器文件监控平台,能够实时监控Web目录文件变化(新增,修改,删除),判断文件内容是否包含恶意代码,自动隔离常见Webshell,保证Web目录文件安全。   Falcon 0.1.1 ...

    服务器监控程序部署

    一、服务器监控的重要性 1. 故障预防:通过实时监控,可以预警潜在的硬件故障、资源瓶颈或系统异常,提前采取措施避免服务中断。 2. 性能优化:监控数据有助于分析服务器性能,找出性能瓶颈,进而优化资源配置,提升...

    Linux集群环境下监控Web服务器的Shell脚本设计.pdf

    文章首先介绍了守护进程和Shell的基本概念及其特性,然后针对Linux集群下如何有效管理多台服务器,以监控Web服务器为例,设计了一种Shell脚本守护程序,并对其进行了验证测试。结果表明,该Shell脚本监控Web服务器是...

    (linux下C语言实现)简易web服务器

    在Linux环境下,使用C语言编写一个简易的Web服务器是一项具有挑战性的任务,它涉及到网络编程、HTTP协议理解和操作系统层面的知识。下面将详细讲解这个项目所涵盖的关键知识点。 首先,我们来了解一下C语言在网络...

    基于嵌入式Linux和Web服务器的网络视频监控系统.pdf

    基于嵌入式Linux和Web服务器的网络视频监控系统.pdf 标题:“基于嵌入式Linux和Web服务器的网络视频监控系统” 描述:“基于嵌入式Linux和Web服务器的网络视频监控系统” 标签:“Linux操作系统、系统开发、参考...

    Web服务器安全设置

    在当今互联网安全日益受到重视的背景下,Web服务器作为信息发布和...随着技术的不断进步和网络环境的不断变化,Web服务器安全将是一个持续的、动态的过程,需要不断地监控、评估和更新安全措施,以应对新的安全威胁。

    WEB服务器安装配置完全手册

    一、Web服务器概述 Web服务器是一种软件,其主要功能是接收来自客户端(通常是Web浏览器)的HTTP请求,并返回相应的HTTP响应,这些响应可能包含HTML文件、图片、视频等网络资源。常见的Web服务器软件有Apache、Nginx...

Global site tag (gtag.js) - Google Analytics