Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
f52de7e
Revert "ProcessList Update add"
bg0820 Jul 13, 2017
7415909
Revert "Revert "ProcessList Update add""
bg0820 Jul 13, 2017
c788e0d
DataManager Class add
bg0820 Jul 13, 2017
81ae258
SystemDiskIO main function remove, DataManager Update function cpu up…
bg0820 Jul 13, 2017
2f551a2
System Memory function param type change
bg0820 Jul 13, 2017
9175a43
memory update add, memory class usage function name change usage > us…
bg0820 Jul 13, 2017
ae5a2d8
DataManager get Os Info add
bg0820 Jul 13, 2017
01e0153
SystemNetwork Network Update
bg0820 Jul 13, 2017
174fd8c
member variable :: -> this-> change and strReplace function remove
bg0820 Jul 13, 2017
e9b56a3
Util stringReplace function add
bg0820 Jul 13, 2017
1e0520e
this->CallbackProc -> SystemDiskIO::CallbackProc
bg0820 Jul 13, 2017
f2b07c4
Process:: -> this-> change
bg0820 Jul 13, 2017
29612a9
Process GetIcon function add, isRunning function add
bg0820 Jul 13, 2017
040e413
ProcessList Code reorganization
bg0820 Jul 13, 2017
2db0c86
Process Class HANDLE null check add
bg0820 Jul 13, 2017
a9d7bcd
ULONG getPidFromHwnd(HWND hwnd) function remove
bg0820 Jul 13, 2017
a065ff0
ProcessList Class Process* ProcessList::getProcess(const DWORD proces…
bg0820 Jul 13, 2017
cf0836d
SystemDiskIO Class size() function re call change, DataManager TQTime…
bg0820 Jul 13, 2017
da4acc8
main function Error correction
bg0820 Jul 13, 2017
5559426
PVOID GetPebAddress(HANDLE ProcessHandle); function remove
bg0820 Jul 13, 2017
dd3dd5b
Update README.md
bg0820 Jul 13, 2017
4bf8626
Process getOwnerName function add
bg0820 Jul 13, 2017
4290376
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 13, 2017
873dff2
Process ~Process() DestroyIcon(icon) add
bg0820 Jul 13, 2017
053d069
Process getCreateTime function add
bg0820 Jul 13, 2017
1207087
code arrangement
bg0820 Jul 13, 2017
89ffd96
code was re arrangement
bg0820 Jul 13, 2017
bba00c2
memory leak solved
bg0820 Jul 13, 2017
01c9d96
Memory Leak Solved
bg0820 Jul 14, 2017
fed9a7d
Fixed error returning character
bg0820 Jul 14, 2017
cbfd1e7
Code cleanup
bg0820 Jul 14, 2017
c7698c5
Improve a Process Call time, Code Clean-Up
bg0820 Jul 14, 2017
5baa9dd
Memory Leak Solved
bg0820 Jul 14, 2017
a829ab7
Replace a GetIcon Function, High Resolution ICON get out
bg0820 Jul 14, 2017
be924c5
Fixed Error getIcon function
bg0820 Jul 14, 2017
8f8dce5
Solved a Buffer Overflow
bg0820 Jul 14, 2017
19d1422
Replace a non-safe function strcpy() -> safe function strcpy_s()
bg0820 Jul 14, 2017
9c8b407
Remove a stdafx.h
bg0820 Jul 14, 2017
74da3a1
:rocket: Add a Json.lib
bg0820 Jul 14, 2017
a9c2ab7
:rocket: Replace a Json.lib add in project
bg0820 Jul 14, 2017
512ce43
:rocket: Add a Json Library
bg0820 Jul 14, 2017
11b1b14
Update README.md
bg0820 Jul 14, 2017
663dbce
Update README.md
bg0820 Jul 14, 2017
7d55d11
:fire: Remove a jsoncpp, :wrench: changed rapidjson
bg0820 Jul 14, 2017
b17d3a5
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 14, 2017
97499b3
Update README.md
bg0820 Jul 15, 2017
0d7b839
Update README.md
bg0820 Jul 15, 2017
8ea2d60
Update README.md
bg0820 Jul 15, 2017
00e62a9
:bug: Fixed Error Process getMemoryUsage handle null check add
bg0820 Jul 15, 2017
c23de3e
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 15, 2017
f20dc6a
:bug: Fixed Error DataManager Class delete when Class Destructor
bg0820 Jul 15, 2017
ab850c8
Update README.md
bg0820 Jul 15, 2017
0459653
Update README.md
bg0820 Jul 15, 2017
39b53a3
Update README.md
bg0820 Jul 15, 2017
a305e7b
:construction: Add a Comment
bg0820 Jul 15, 2017
4404595
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 15, 2017
fa3bace
:hammer: Code Refactoring : :zap: Process Thread Count function Now o…
bg0820 Jul 15, 2017
8ebebed
:lock: Replaced a hash_map as unordered_map
bg0820 Jul 15, 2017
c01ddc5
:sparkles: Add a getTotalThreadCount function
bg0820 Jul 15, 2017
743c8d4
:zap: Improve a Process getCpuUsage function, :sparkles: microDelay f…
bg0820 Jul 15, 2017
dda5f47
:lock: Add a Process initFileNamePath function in nResult check
bg0820 Jul 16, 2017
aab35a4
:fire: Remove a getCpuIdle function
bg0820 Jul 16, 2017
410920a
:fire: Remove a getIdleUsage function in header
bg0820 Jul 16, 2017
04d1e76
:construction: Add a jsonWrite
bg0820 Jul 16, 2017
4e9e386
:construction: Replace a type changed DWORD -> ULONG, DWORDLONG -> UL…
bg0820 Jul 16, 2017
aab8748
:alien: Replace a memoryLoadPercent function param variable type change
bg0820 Jul 16, 2017
f51958c
:lock: Replace a strcpy -> strcpy_s and remove a memcpy function
bg0820 Jul 16, 2017
8fd0562
Update README.md
bg0820 Jul 16, 2017
c806147
:hammer: Code refactoring, :ambulance: Memory Leak Solved
bg0820 Jul 16, 2017
e565426
:art: Moved a getHwnd function in Process class as ProcessList class,…
bg0820 Jul 16, 2017
69fa1e7
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 16, 2017
a705a57
:fire: Removed a main function is ProcessList class
bg0820 Jul 16, 2017
ee28f8e
:fire: Removed a Stopwatch
bg0820 Jul 16, 2017
d302487
:sparkles: Add a getCreateTime function
bg0820 Jul 16, 2017
0ea65c4
Update README.md
bg0820 Jul 16, 2017
f2dd798
Update README.md
bg0820 Jul 16, 2017
6ccb1f8
:sparkles: Add a Json Write
bg0820 Jul 17, 2017
6459475
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 17, 2017
cda2b98
:hankey: Add a comment
bg0820 Jul 17, 2017
c7a3dc8
Update README.md
bg0820 Jul 17, 2017
850c382
:truck: Move a library file, :bento: Add a lz4 compression library
bg0820 Jul 17, 2017
d05d4d1
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 17, 2017
71a3f05
Update README.md
bg0820 Jul 17, 2017
c84e006
Update README.md
bg0820 Jul 17, 2017
2a43076
:construction: Add a Compress, Compressibility 18%(The lower the thre…
bg0820 Jul 17, 2017
0f55631
Merge branch 'return' of https://github.com/bg0820/SMS into return
bg0820 Jul 17, 2017
7c19edb
:construction: Add a DeCompress function
bg0820 Jul 17, 2017
2105d55
:construction: Add a getTimeString function, getJsonNetworkConnection…
bg0820 Jul 17, 2017
d5cb18d
:art: Moved a Compress. DeCompress function in DataManager class as U…
bg0820 Jul 17, 2017
94b089e
:construction: Add a Thread Class
bg0820 Jul 17, 2017
a486aa8
:bug: Fixed Error Compress, DeCompress function
bg0820 Jul 18, 2017
9f3bf1d
:construction: Code refactoring
bg0820 Jul 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 80 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,87 @@
# SMS - Server Monitoring Service

### (this project is not a finished project.)
### Server Monitoring Service
#### > SMS Agent
#### > Data Server
#### > Web Server (Visualization)
###

### **Server Monitoring Service (SMS)**
>#### SMS Agent
>#### Data Server
>#### Web Server (Visualization)
---
##### 현재 이 프로젝트는 개발중 입니다.
##### this project is work in progress.
##### 크로스 플랫폼 지원 예정입니다. 현재는 윈도우만 지원중
##### Cross-platform support is being planned. Currently, only Windows is supported.

##### Cross-platform support be expected. Currently, only Windows is supported.
## List Collected by Agent

* Cpu
* CpuUsage
* CpuIdle
* CpuModel
* Memory
* MemoryLoadPercent
* MemoryUsedByte
* MemoryFreeByte
* MemoryTotalByte
* System Info
* UserName
* ComputerName
* OsVersionName
* Disk
* Path
* Name
* FileFormat
* UsedBytes
* TotalBytes
* FreeBytes
* Type
* DiskPerformance
* ReadSec
* WriteSec
* DiskCount
* Process
* PID
* CommandLine
* Name
* Path
* Owner
* CreateTime
* HandleCount
* ThreadCount
* MemoryUsage
* CpuUsage
* TotalThreadCount
* Network Connection Info
* ProtocolType
* LocalEndpoint
* IPV4
* IPV6
* Port
* RemoteEndpoint
* IPV4
* IPV6
* Port
* State
* ProcessID
* CreateTime
* OwnerInfo
* NetworkConnectionCount
* Network Adapter Info
* AdapterCount

## Network Protocol

#### SMS Agent -> (TCP)
#### (TCP) Data Server -> (WebSocket)
#### (WebSocket) Web Server

## Used Library
| Library Name | Link | License |
| :---------------: | :-----------------: | :-------------------: |
| RapidJson | <https://github.com/miloyip/rapidjson/> | MIT |
| LZ4 | <https://github.com/lz4/lz4> | BSD |

## Commit Message
https://gitmoji.carloscuesta.me/

## Info
[![npm](https://img.shields.io/badge/email-bg0820%40naver.com-red.svg)]()
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<ClCompile Include="network socket\NetworkManager.cpp" />
<ClCompile Include="util\Log.cpp" />
<ClCompile Include="util\StopWatch.cpp" />
<ClCompile Include="util\Thread.cpp" />
<ClCompile Include="util\Util.cpp" />
</ItemGroup>
<ItemGroup>
Expand All @@ -127,6 +128,7 @@
<ClInclude Include="network socket\NetworkManager.hpp" />
<ClInclude Include="util\Log.hpp" />
<ClInclude Include="util\StopWatch.hpp" />
<ClInclude Include="util\Thread.hpp" />
<ClInclude Include="util\Util.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
<ClCompile Include="data\ClientManager.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
<ClCompile Include="util\Thread.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="util\StopWatch.hpp">
Expand All @@ -62,5 +65,8 @@
<ClInclude Include="data\Client.hpp">
<Filter>헤더 파일</Filter>
</ClInclude>
<ClInclude Include="util\Thread.hpp">
<Filter>헤더 파일</Filter>
</ClInclude>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Client* ClientManager::add(SOCKADDR_IN paramAddr, SOCKET paramClientSocket)
client->recvBytes = 0;
client->sendBytes = 0;

clientList.insert(hash_map<string, Client*>::value_type(ip, client));
clientList.insert(unordered_map<string, Client*>::value_type(ip, client));

string str = Util::format("Client Connected [%s], Count : %d", ip.c_str(), getCount());
Log::printLog(str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

#include "../util/Log.hpp"
#include <Windows.h>
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1
#include <hash_map>
#include <unordered_map>

using namespace std;

class ClientManager
{
private:
hash_map<string, Client*> clientList;
unordered_map<string, Client*> clientList;
int clientCount = 0;
public:
Client* add(SOCKADDR_IN paramAddr, SOCKET paramClientSocket);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include "NetworkListener.hpp"


DWORD WINAPI NetworkListener::threadProc(LPVOID hIOCP)
DWORD NetworkListener::callbackProc(LPVOID hIOCP)
{
NetworkListener * instance = reinterpret_cast <NetworkListener *> (hIOCP);

HANDLE threadHandler = *((HANDLE *)hIOCP);
DWORD receiveBytes;
DWORD sendBytes;
Expand Down Expand Up @@ -258,13 +260,12 @@ int NetworkListener::Init(SOCKET &paramSocket, SOCKADDR_IN &parmAddr, int &param
HANDLE hIOCP = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
ULONG threadId;


// Create Thread
for (int i = 0; i < this->threadCount; i++)
{
// [&]() {networkProc(serverSocket, addr);

hThread[i] = CreateThread(NULL, 0, std::bind(threadProc, this), &hIOCP, 0, &threadId);
//
ThreadWrapper *threadWrapper = new ThreadWrapper(std::bind(&NetworkListener::callbackProc, this), &hIOCP);
//hThread[i] = CreateThread(NULL, 0, std::bind(&NetworkListener::threadProc, this), &hIOCP, 0, &threadId);
}

handle = hIOCP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include "../data/Client.hpp"
#include "../data/ClientManager.hpp"
#include <atlstr.h>
/*
Thread Class
*/
#include "../util/Thread.hpp"

#pragma comment(lib, "ws2_32.lib") // WinSock2 Lib

Expand Down Expand Up @@ -48,7 +52,7 @@ class NetworkListener
private:
int Init(SOCKET &pSocket, SOCKADDR_IN &paramAddr, int &paramRetValue, HANDLE &handle);
void initSocketAddr(BOOLEAN IPv6);
DWORD WINAPI threadProc(LPVOID hIOCP);
DWORD callbackProc(LPVOID hIOCP);
public:
NetworkListener(TCHAR *ip, USHORT port) : serverIp(ip), serverPort(port)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "Thread.hpp"

DWORD WINAPI ThreadWrapper::threadProc(LPVOID lpParameter)
{
// copy
ThreadWrapper* obj = (ThreadWrapper*)lpParameter;

if (obj->func)
obj->func(obj->lpParam);

return 1;
}

void ThreadWrapper::run()
{
if (this->threadHandle) // timer is exist
abort();

ULONG threadID;
this->threadHandle= CreateThread(NULL, 0, threadProc, (PVOID)this, 0, &threadID);
this->threadID = threadID;
}

void ThreadWrapper::abort()
{
DWORD result = 0;
GetExitCodeThread(this->threadHandle, &result);

if (threadHandle)
CloseHandle(threadHandle);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef _THREAD_H_
#define _THREAD_H_

#include <functional>
#include <Windows.h>
#include <thread>

using namespace std;

class ThreadWrapper
{
private:
static UINT threadCount;
HANDLE threadHandle = NULL;
//HANDLE timerQueue = NULL;
UINT threadID = 0;
LPVOID lpParam;
//UINT interval = 0;
static DWORD WINAPI threadProc(LPVOID lpParameter);
public:
function<void(LPVOID)> func = NULL;
public:
ThreadWrapper(function<void(LPVOID)> paramFunc, HANDLE lpParam)
{
this->threadCount++;
this->func = paramFunc;
this->lpParam = lpParam;
}

~ThreadWrapper()
{
if (threadHandle)
abort();
}

void run();
void abort();
};

#endif // !_THREAD_H_
Loading