시스템 정보는 연결된 드라이브정보, 이벤트로그(EventLog) 정보 정도로 하지. 대충 요런식..
public ArrayList GetDriveInfo()
{
DriveInfo[] drv = DriveInfo.GetDrives();
ArrayList DriveInfoList = new ArrayList();
foreach (DriveInfo d in drv)
{
if(d.DriveType != DriveType.Fixed)
continue;
DriveInfoList.Add(d.Name.Replace(":\\", "") + " : " + (d.AvailableFreeSpace * 100) / (d.TotalSize) + "%\r\n");
}
return DriveInfoList;
}
public ArrayList GetEventLogInfo()
{
ArrayList EventLogList = new ArrayList();
EventLog[] log = EventLog.GetEventLogs();
foreach (EventLog el in log)
{
if (el.Log != "System")
continue;
EventLogEntryCollection elec = el.Entries;
foreach (EventLogEntry ele in elec)
{
if (ele.TimeWritten.Date < DateTime.Now.Date)
continue;
if (ele.EntryType == EventLogEntryType.Error)
EventLogList.Add(ele.Source + " : " + ele.EventID + "\r\n");
}
}
return EventLogList;
}
Helper helper = new Helper();
//드라이브 정보 얻어옴
ArrayList DriveList = helper.GetDriveInfo();
string strDriveInfo = null;
foreach (string s in DriveList)
strDriveInfo += s + "\t";
//EventLog 얻어옴
ArrayList EventLogList = helper.GetEventLogInfo();
string strEventLogInfo = null;
foreach (string s in EventLogList)
strEventLogInfo += s + "\t";
SmtpClient client = new SmtpClient(메일주소, 메일사용포트);
client.UseDefaultCredentials = false;
client.EnableSsl = false;
MailAddress from = new MailAddress("najsulman@nate.com");
MailAddress to = new MailAddress(strEmailAddr);
MailMessage message = new MailMessage(from, to);
message.Subject = "JiranServerManager Infomation Mail " + DateTime.Now;
message.Body = "This is JiranServerManager Reporting Message.=^.^=" + Environment.NewLine;
message.BodyEncoding = Encoding.UTF8;
message.Body += Environment.NewLine;
try
{
//동기로 메일을 보낸다.
client.Send(message);
message.Dispose();
}
catch (System.Exception ex)
{
//에러따윈 처리하지 않아
}
'프로그래밍' 카테고리의 다른 글
SQL Server & SQLCE Identity값(SEED값) 알아오는 쿼리 (0) | 2012.11.29 |
---|---|
HTML5 강좌 링크 (0) | 2012.11.16 |
[C#]SHA256 방식 암호화 방법 적용 (0) | 2012.11.15 |
[C#]구글 주소록 연동 (0) | 2012.08.16 |
[C#]TTS 관련 한국어지원 발견.. (0) | 2012.07.27 |
댓글