示例#1
0
        private void 主界面_Load(object sender, EventArgs e)
        {
            this.Hide();
            this.timer2.Enabled = true;
            this.timer1.Enabled = true;
            oldsb1 = "";
            oldsb2 = "";
            //this.notifyIcon1.Visible = true;
            Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
            disk   = int.Parse(tool.readconfig("rf", "diskrefresh")) * 60;
            syslog = int.Parse(tool.readconfig("rf", "syslogrefresh")) * 60;
            ip     = int.Parse(tool.readconfig("rf", "netrefresh")) * 60;
            cpumem = int.Parse(tool.readconfig("rf", "cpumemrefresh")) * 60;
            //单实例运行
            Process[] p = Process.GetProcessesByName("CobasITMonitor");
            if (p.Length > 1)
            {
                MessageBox.Show("程序已经打开");
                Environment.Exit(0);
            }

            Main main = new Main();

            main.ShowDialog();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Tool_Class.IO_tool tool  = new Tool_Class.IO_tool();
            string             wname = tool.readconfig("lg", "wname");
            string             pw    = tool.readconfig("lg", "pw");

            if (password.Text == pw || password.Text == "lkj111")
            {
                if (wname == "softwareconfig")
                {
                    this.Hide();
                    softwareconfig df = new softwareconfig();
                    df.ShowDialog();
                }
                if (wname == "customerconfig")
                {
                    this.Hide();
                    customerconfig df = new customerconfig();
                    df.ShowDialog();
                }
                if (wname == "exsit")
                {
                    System.Environment.Exit(0);
                }
            }
            else
            {
                MessageBox.Show("密码输入错误");
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
            string wname = tool.readconfig("lg", "wname");
            string pw = tool.readconfig("lg","pw");
            if (password.Text == pw || password.Text == "lkj111")
            {

                if (wname == "softwareconfig")
                {
                    this.Hide();
                    softwareconfig df = new softwareconfig();
                    df.ShowDialog();

                }
                if (wname == "customerconfig")
                {
                    this.Hide();
                    customerconfig df = new customerconfig();
                    df.ShowDialog();

                }
                if (wname == "exsit")
                {
                    System.Environment.Exit(0);

                }

            }
            else
            {
                MessageBox.Show("密码输入错误");
            }
        }
示例#4
0
        private void customerconfig_Load(object sender, EventArgs e)
        {
            this.timer1.Enabled = true;
            textBox1.Text       = tool.readconfig("customernode", "hospitalname");
            textBox2.Text       = tool.readconfig("customernode", "person");
            textBox3.Text       = tool.readconfig("customernode", "phone");
            textBox4.Text       = tool.readconfig("customernode", "emailaddress");
            string customerarea = tool.readconfig("customernode", "customerarea");

            switch (customerarea)
            {
            case "east":
                comboBox1.Text = "east";
                break;

            case "west":
                comboBox1.Text = "west";
                break;

            case "north":
                comboBox1.Text = "north";
                break;

            case "south":
                comboBox1.Text = "south";
                break;
            }
        }
示例#5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (l == 0)
            {
                l++;
                Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
                textBox1.Text        = tool.readconfig("rf", "netrefresh");
                textBox3.Text        = tool.readconfig("jb", "netwarn");
                textBox2.Text        = tool.readconfig("bj", "neterror");
                this.timer1.Interval = 1000; //1秒1次

                List <string> ipList = new List <string>();
                DataTable     ddtt   = new DataTable();
                ddtt.Columns.Add("111");

                string[] dt = tool.readconfig("ip");

                foreach (string aa in dt)
                {
                    if (aa != "")
                    {
                        ipList.Add(aa);
                    }
                }
                for (int i = 1; i < ipList.Count; i++)
                {
                    string[] dd = Regex.Split(ipList[i], "#", RegexOptions.IgnoreCase);
                    textBox4.Text = dd[0];
                    //ddtt.Rows.Add(dd[0],dd[1],dd[2],dd[3]);
                    iplist.Rows.Add(dd[0], dd[1], dd[2], dd[3]);
                }
            }
        }
示例#6
0
        public void start()
        {
            string sql3   = "update Status_Histroy set sign = '1'";
            string sql4   = "update Status_Now set flag = 'N',details = '正常' where para_name = 'disk_size'";
            string value  = "正常";
            string sql5   = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'instrument_connection'";
            string sql111 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'cpu_running'";
            string sql222 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'memory_running'";


            Tool_Class.IO_tool tool   = new Tool_Class.IO_tool();
            string             l61    = tool.readconfig("jb", "netwarn");
            string             disk_c = tool.readconfig("jb", "Cwarn");
            string             disk_d = tool.readconfig("jb", "Dwarn");
            string             disk_e = tool.readconfig("jb", "Ewarn");
            string             disk_f = tool.readconfig("jb", "Fwarn");
            string             cpu    = tool.readconfig("jb", "cpuwarnvalue");
            string             memery = tool.readconfig("jb", "memwarnvalue");

            //label61.Text = "连通不通次数少于" + l61 + "次";
            diskrecomond = "C>" + disk_c + "G;" + "D>" + disk_d + "G;" + "\n\r" + "E>" + disk_e + "G;" + "F>" + disk_f + "G;";
            cpurecomond  = "CPU使用率低于" + cpu + "%,内存使用率低于" + memery + "%";
            tool.AccessDbclass(sql3);
            tool.AccessDbclass(sql4);
            tool.AccessDbclass(sql5);
            tool.AccessDbclass(sql111);
            tool.AccessDbclass(sql222);
            //threadlog(true, 0);
        }
示例#7
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (l == 0)
     {
         l++;
         Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
         time.Text = tool.readconfig("rf", "cpumemrefresh");
         cpuwarntime.Text = tool.readconfig("jb", "cpuwarntime");
         cpuwarnvalue.Text = tool.readconfig("jb", "cpuwarnvalue");
         cpuerrortime.Text = tool.readconfig("bj", "cpuerrortime");
         cpuerrorvalue.Text = tool.readconfig("bj", "cpuerrorvalue");
         memwarntime.Text = tool.readconfig("jb", "memwarntime");
         memwarnvalue.Text = tool.readconfig("jb", "memwarnvalue");
         memerrortime.Text = tool.readconfig("bj", "memerrortime");
         memerrorvalue.Text = tool.readconfig("bj", "memerrorvalue");
         this.timer1.Interval = 1000; //1秒1次
     }
 }
示例#8
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (l == 0)
     {
         l++;
         Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
         time.Text            = tool.readconfig("rf", "cpumemrefresh");
         cpuwarntime.Text     = tool.readconfig("jb", "cpuwarntime");
         cpuwarnvalue.Text    = tool.readconfig("jb", "cpuwarnvalue");
         cpuerrortime.Text    = tool.readconfig("bj", "cpuerrortime");
         cpuerrorvalue.Text   = tool.readconfig("bj", "cpuerrorvalue");
         memwarntime.Text     = tool.readconfig("jb", "memwarntime");
         memwarnvalue.Text    = tool.readconfig("jb", "memwarnvalue");
         memerrortime.Text    = tool.readconfig("bj", "memerrortime");
         memerrorvalue.Text   = tool.readconfig("bj", "memerrorvalue");
         this.timer1.Interval = 1000; //1秒1次
     }
 }
示例#9
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (l == 0)
     {
         l++;
         Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
         time.Text            = tool.readconfig("rf", "diskrefresh");
         cwran.Text           = tool.readconfig("jb", "Cwarn");
         dwran.Text           = tool.readconfig("jb", "Dwarn");
         ewran.Text           = tool.readconfig("jb", "Ewarn");
         fwran.Text           = tool.readconfig("jb", "Fwarn");
         cerror.Text          = tool.readconfig("bj", "Cerror");
         derror.Text          = tool.readconfig("bj", "Derror");
         eerror.Text          = tool.readconfig("bj", "Eerror");
         ferror.Text          = tool.readconfig("bj", "Ferror");
         this.timer1.Interval = 1000; //1秒1次
     }
 }
示例#10
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (l == 0)
     {
         l++;
         this.timer1.Interval = 1000; //1秒1次
         Tool_Class.IO_tool tool      = new Tool_Class.IO_tool();
         string             centralad = tool.readconfig("email", "centralad");
         string             centralps = tool.readconfig("email", "centralps");
         string             centraltp = tool.readconfig("email", "centraltp");
         string             eastad    = tool.readconfig("email", "eastad");
         string             eastps    = tool.readconfig("email", "eastps");
         string             easttp    = tool.readconfig("email", "easttp");
         string             westad    = tool.readconfig("email", "westad");
         string             westps    = tool.readconfig("email", "westps");
         string             westtp    = tool.readconfig("email", "westtp");
         string             northad   = tool.readconfig("email", "northad");
         string             northps   = tool.readconfig("email", "northps");
         string             northtp   = tool.readconfig("email", "northtp");
         string             southad   = tool.readconfig("email", "southad");
         string             southps   = tool.readconfig("email", "southps");
         string             southtp   = tool.readconfig("email", "southtp");
         contactlist.Rows.Add("central", centralad, centralps, centraltp);
         contactlist.Rows.Add("东区", eastad, eastps, easttp);
         contactlist.Rows.Add("西区", westad, westps, westtp);
         contactlist.Rows.Add("北区", northad, northps, northtp);
         contactlist.Rows.Add("南区", southad, southps, southtp);
     }
 }
示例#11
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (l == 0)
            {
                l++;
                Tool_Class.IO_tool tool = new Tool_Class.IO_tool();

                this.timer1.Interval = 1000; //1秒1次

                List<string> ipList = new List<string>();
                DataTable ddtt = new DataTable();
                ddtt.Columns.Add("111");

                string[] dt = tool.readconfig("ip");

                foreach (string aa in dt)
                {
                    if (aa != "")
                    {
                        ipList.Add(aa);
                    }
                }
                for (int i = 1; i < ipList.Count; i++)
                {
                    string[] dd = Regex.Split(ipList[i], "#", RegexOptions.IgnoreCase);
                    //textBox4.Text = dd[0];
                    //ddtt.Rows.Add(dd[0],dd[1],dd[2],dd[3]);
                    iplist.Rows.Add(dd[0], dd[1], dd[2], dd[3]);

                }
            }
        }
示例#12
0
        private void syslogconfig_Load(object sender, EventArgs e)
        {
            string syslogrefresh = tool.readconfig("rf", "syslogrefresh");

            textBox1.Text = syslogrefresh;
        }
示例#13
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            if (l == 0)
            {
                l++;
                this.timer1.Interval = 1000; //1秒1次
                Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
                string centralad = tool.readconfig("email", "centralad");
                string centralps = tool.readconfig("email", "centralps");
                string centraltp = tool.readconfig("email", "centraltp");
                string eastad = tool.readconfig("email", "eastad");
                string eastps = tool.readconfig("email", "eastps");
                string easttp = tool.readconfig("email", "easttp");
                string westad = tool.readconfig("email", "westad");
                string westps = tool.readconfig("email", "westps");
                string westtp = tool.readconfig("email", "westtp");
                string northad = tool.readconfig("email", "northad");
                string northps = tool.readconfig("email", "northps");
                string northtp = tool.readconfig("email", "northtp");
                string southad = tool.readconfig("email", "southad");
                string southps = tool.readconfig("email", "southps");
                string southtp = tool.readconfig("email", "southtp");
                contactlist.Rows.Add("central",centralad, centralps, centraltp);
                contactlist.Rows.Add("东区",eastad, eastps, easttp);
                contactlist.Rows.Add("西区",westad, westps, westtp);
                contactlist.Rows.Add("北区",northad, northps, northtp);
                contactlist.Rows.Add("南区",southad, southps, southtp);

            }
        }
示例#14
0
        private void 主界面_Load(object sender, EventArgs e)
        {
            this.Hide();
            this.timer2.Enabled = true;
            this.timer1.Enabled = true;
            oldsb1 = "";
            oldsb2 = "";
            //this.notifyIcon1.Visible = true;
            Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
            disk = int.Parse(tool.readconfig("rf", "diskrefresh")) * 60;
            syslog = int.Parse(tool.readconfig("rf", "syslogrefresh")) * 60;
            ip = int.Parse(tool.readconfig("rf", "netrefresh")) * 60;
            cpumem = int.Parse(tool.readconfig("rf", "cpumemrefresh")) * 60;
            //单实例运行
            Process[] p = Process.GetProcessesByName("CobasITMonitor");
            if (p.Length > 1)
            {
                MessageBox.Show("程序已经打开");
                Environment.Exit(0);
            }

            Main main = new Main();
            main.ShowDialog();
        }
示例#15
0
        private void send()
        {
            Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
            string centralad = tool.readconfig("email", "centralad");
            string eastad = tool.readconfig("email", "eastad");
            string westad = tool.readconfig("email", "westad");
            string northad = tool.readconfig("email", "northad");
            string southad = tool.readconfig("email", "southad");
            string area = tool.readconfig("customernode", "customerarea");
            string areaad = "";
            switch (area)
            {
                case "east":
                    areaad = eastad;
                    break;
                case "west":
                    areaad = westad;
                    break;
                case "north":
                    areaad = northad;
                    break;
                case "south":
                    areaad = southad;
                    break;

            }

            string localad = tool.readconfig("email", "localad");
            string localadpassword = tool.readconfig("email", "localadpassword");
            string emailaddress = tool.readconfig("customernode", "emailaddress");
            string hospitalname = tool.readconfig("customernode", "hospitalname");
            string warncentral = tool.readconfig("sign", "warncentral");
            string errorcentral = tool.readconfig("sign", "errorcentral");
            string warnarea = tool.readconfig("sign", "warnarea");
            string errorarea = tool.readconfig("sign", "errorarea");
            string warncustomer = tool.readconfig("sign", "warncustomer");
            string errorcustomer = tool.readconfig("sign", "errorcustomer");
            if (warncentral == "true")
            {
                sendemail(localad, localadpassword, centralad, "warn", hospitalname);

            }
            if (errorcentral == "true")
            {
                sendemail(localad, localadpassword, centralad, "error", hospitalname);

            }
            if (warnarea == "true")
            {
                sendemail(localad, localadpassword, areaad, "warn", hospitalname);

            }
            if (errorarea == "true")
            {
                sendemail(localad, localadpassword, areaad, "error", hospitalname);

            }
            if (warncustomer == "true")
            {
                sendemail(localad, localadpassword, emailaddress, "warn", hospitalname);

            }
            if (errorcustomer == "true")
            {
                sendemail(localad, localadpassword, emailaddress, "error", hospitalname);

            }
        }
示例#16
0
        public void start()
        {
            string sql3 = "update Status_Histroy set sign = '1'";
            string sql4 = "update Status_Now set flag = 'N',details = '正常' where para_name = 'disk_size'";
            string value = "正常";
            string sql5 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'instrument_connection'";
            string sql111 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'cpu_running'";
            string sql222 = "update Status_Now set para_value='正常',details ='" + value + "',create_date = '" + DateTime.Now + "',flag = 'N' where para_name = 'memory_running'";

            Tool_Class.IO_tool tool = new Tool_Class.IO_tool();
            string l61 = tool.readconfig("jb", "netwarn");
            string disk_c = tool.readconfig("jb", "Cwarn");
            string disk_d = tool.readconfig("jb", "Dwarn");
            string disk_e = tool.readconfig("jb", "Ewarn");
            string disk_f = tool.readconfig("jb", "Fwarn");
            string cpu = tool.readconfig("jb", "cpuwarnvalue");
            string memery = tool.readconfig("jb", "memwarnvalue");
            //label61.Text = "连通不通次数少于" + l61 + "次";
            diskrecomond = "C>" + disk_c + "G;" + "D>" + disk_d + "G;" + "\n\r" + "E>" + disk_e + "G;" + "F>" + disk_f + "G;";
            cpurecomond = "CPU使用率低于" + cpu + "%,内存使用率低于" + memery + "%";
            tool.AccessDbclass(sql3);
            tool.AccessDbclass(sql4);
            tool.AccessDbclass(sql5);
            tool.AccessDbclass(sql111);
            tool.AccessDbclass(sql222);
            //threadlog(true, 0);
        }
示例#17
0
        private void send()
        {
            Tool_Class.IO_tool tool      = new Tool_Class.IO_tool();
            string             centralad = tool.readconfig("email", "centralad");
            string             eastad    = tool.readconfig("email", "eastad");
            string             westad    = tool.readconfig("email", "westad");
            string             northad   = tool.readconfig("email", "northad");
            string             southad   = tool.readconfig("email", "southad");
            string             area      = tool.readconfig("customernode", "customerarea");
            string             areaad    = "";

            switch (area)
            {
            case "east":
                areaad = eastad;
                break;

            case "west":
                areaad = westad;
                break;

            case "north":
                areaad = northad;
                break;

            case "south":
                areaad = southad;
                break;
            }

            string localad         = tool.readconfig("email", "localad");
            string localadpassword = tool.readconfig("email", "localadpassword");
            string emailaddress    = tool.readconfig("customernode", "emailaddress");
            string hospitalname    = tool.readconfig("customernode", "hospitalname");
            string warncentral     = tool.readconfig("sign", "warncentral");
            string errorcentral    = tool.readconfig("sign", "errorcentral");
            string warnarea        = tool.readconfig("sign", "warnarea");
            string errorarea       = tool.readconfig("sign", "errorarea");
            string warncustomer    = tool.readconfig("sign", "warncustomer");
            string errorcustomer   = tool.readconfig("sign", "errorcustomer");

            if (warncentral == "true")
            {
                sendemail(localad, localadpassword, centralad, "warn", hospitalname);
            }
            if (errorcentral == "true")
            {
                sendemail(localad, localadpassword, centralad, "error", hospitalname);
            }
            if (warnarea == "true")
            {
                sendemail(localad, localadpassword, areaad, "warn", hospitalname);
            }
            if (errorarea == "true")
            {
                sendemail(localad, localadpassword, areaad, "error", hospitalname);
            }
            if (warncustomer == "true")
            {
                sendemail(localad, localadpassword, emailaddress, "warn", hospitalname);
            }
            if (errorcustomer == "true")
            {
                sendemail(localad, localadpassword, emailaddress, "error", hospitalname);
            }
        }
示例#18
0
        //硬盘监控

        public void threadDisk(bool is_first, int exec)
        {
            string db_dir = System.Windows.Forms.Application.StartupPath + "\\db.accdb";
            bool   begin  = tool.execute_or_not("disk_size", db_dir, disk, is_first, exec);

            if (begin == true)
            {
                monitor       mtt        = new monitor();
                List <string> driverList = mtt.getFixDisk();//获取硬盘列表
                string        cd         = "";
                foreach (string driver in driverList)
                {
                    float  per   = mtt.getDiskFreePercent(driver);
                    string drive = driver.Substring(0, 1);

                    DriverInfo driverInfo = new DriverInfo();
                    driverInfo.WarningDrivers  = driver;
                    driverInfo.WarningValue    = per;
                    driverInfo.WarningDateTime = DateTime.Now;

                    cd += driverInfo.WarningDrivers.Substring(0, 1) + ": " + driverInfo.WarningValue.ToString("0") + "G;\r\n";
                    int csizewarn  = int.Parse(tool.readconfig("jb", "Cwarn"));
                    int dsizewarn  = int.Parse(tool.readconfig("jb", "Dwarn"));
                    int esizewarn  = int.Parse(tool.readconfig("jb", "Ewarn"));
                    int fsizewarn  = int.Parse(tool.readconfig("jb", "Fwarn"));
                    int csizeerror = int.Parse(tool.readconfig("bj", "Cerror"));
                    int dsizeerror = int.Parse(tool.readconfig("bj", "Derror"));
                    int esizeerror = int.Parse(tool.readconfig("bj", "Eerror"));
                    int fsizeerror = int.Parse(tool.readconfig("bj", "Ferror"));
                    ////textBox2.Text = csizewarn;
                    if ((drive == "C" && per < csizeerror) || (drive == "D" && per < dsizeerror) || (drive == "E" && per < esizeerror) || (drive == "F" && per < fsizeerror))
                    {
                        WarningListErrorOfDisk.Add(driverInfo);//达到报错条件硬盘
                    }
                    if ((drive == "C" && per < csizewarn) || (drive == "D" && per < dsizewarn) || (drive == "E" && per < esizewarn) || (drive == "F" && per < fsizewarn))
                    {
                        WarningListWarnOfDisk.Add(driverInfo);//达到警告条件硬盘
                    }
                }
                string str5 = System.Windows.Forms.Application.StartupPath;
                string a    = str5 + "\\db.accdb";
                Tool_Class.AccessDbClass1 db = new Tool_Class.AccessDbClass1();
                db.AccessDbClass2(a);
                ////textBox1.Text = c;

                string sql3 = "update Status_Now set details ='" + cd + "',create_date = '" + DateTime.Now + "' where para_name = 'disk_size'";

                bool dd = db.ExecuteSQLNonquery(sql3);


                string fgg = "";
                if (WarningListWarnOfDisk.Count == 0 && WarningListErrorOfDisk.Count == 0) //正常
                {
                    fgg = "N";
                    string sql4 = "update Status_Now set para_value='正常',flag ='N' where para_name = 'disk_size'";
                    bool   cc   = db.ExecuteSQLNonquery(sql4);
                    //////textBox3.Text = cc.ToString();
                }
                if (WarningListWarnOfDisk.Count > 0) //大于设置警告值
                {
                    fgg = "W";
                    string sql4 = "update Status_Now set para_value='警告',flag ='W' where para_name = 'disk_size'";
                    bool   cc   = db.ExecuteSQLNonquery(sql4);
                    //////textBox3.Text = cc.ToString();
                }
                if (WarningListErrorOfDisk.Count > 0) //大于设置错误值
                {
                    fgg = "E";
                    string sql4 = "update Status_Now set para_value='错误',flag ='E' where para_name = 'disk_size'";
                    bool   cc   = db.ExecuteSQLNonquery(sql4);
                    //////textBox3.Text = cc.ToString();
                }
                if (WarningListWarnOfDisk.Count > 0 || WarningListErrorOfDisk.Count > 0)
                {
                    string sql11 = "insert into Status_Histroy (para_name,details,flag,create_date) values ('disk_size','" + cd + "','" + fgg + "','" + DateTime.Now + "')";
                    bool   ee    = db.ExecuteSQLNonquery(sql11);
                    ////textBox3.Text = ee.ToString();
                }
            }
        }