Skip to content

Commit

Permalink
Merge pull request #34 from sophie0730/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sophie0730 authored Dec 13, 2023
2 parents 1ffb1f7 + 0ded897 commit 192212f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ sudo ntpdate -u pool.ntp.org
- Download the compressed file from Github releases.
You can refer to Github releases and download your preffered version
```
wget https://github.com/sophie0730/PulseTracker/releases/tag/v0.1.1
wget [package_release_url]
```

- Create a new directory and decompress the file
```
tar xvf pulsetracker_0.1.0-beta_linux.tar
tar xvf [package_name].tar
```

- Use docker compose to setup InfluxDB and Redis
Expand All @@ -39,7 +39,7 @@ docker compose up

- Edit .env.template according to your InfluxDB settings. Please remember to rename it to .env after editing all the required information.

- Edit pulse.yml and alert.yml based on your needs.
- Edit pulse.yml and alert.yml based on your needs and environment setting.

- (optional) If you would like to send email or Line message, please register a SMTP server(Mailgun or other services) and Line notify(https://notify-bot.line.me/zh_TW/) token.

Expand Down
4 changes: 1 addition & 3 deletions client/src/components/alert.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ function AlertContainer() {
const alertAPI = `${import.meta.env.VITE_HOST}/api/1.0/alert?page=${currentPage}&limit=${pageSize}`;
const searchAPI = `${import.meta.env.VITE_HOST}/api/1.0/alert/search?page=${currentPage}&term=${searchTerm}&limit=${pageSize}`;

const SERVER_URL = undefined;

const fetchData = () => {
const api = searchTerm ? searchAPI : alertAPI;
axios.get(api)
Expand All @@ -170,7 +168,7 @@ function AlertContainer() {
useEffect(() => {
fetchData();

const socket = io(SERVER_URL);
const socket = io();
socket.on('connect', () => console.log('connected to socket.io server'));
socket.on('dataUpdate', fetchData);

Expand Down
3 changes: 1 addition & 2 deletions client/src/components/target.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ function TargetTitle() {

export function Target() {
const targetAPI = `${import.meta.env.VITE_HOST}/api/1.0/targets`;
const SERVER_URL = 'http://localhost:4000';
const [targetStatus, setTargetStatus] = useState([]);
const [responseError, setError] = useState(null);

Expand All @@ -28,7 +27,7 @@ export function Target() {
setError(error);
});

const socket = io(SERVER_URL);
const socket = io();
socket.on('connect', () => console.log('connected to socket.io server'));
socket.on('dataUpdate', () => {
axios.get(targetAPI)
Expand Down
8 changes: 4 additions & 4 deletions server/exporters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ collectDefaultMetrics({
});

const httpTotalRequest = new client.Gauge({
name: 'http_total_requests',
name: 'Http_Total_Requests',
help: 'http total request',
});

const guageRequestPerSecond = new client.Gauge({
name: 'request_per_second',
name: 'Request_Per_Second',
help: 'Request per second',
labelNames: ['time'],
});

const guageResponseTime = new client.Gauge({
name: 'max_response_time',
help: 'max response time',
name: 'Max_Response_Time',
help: 'ms',
labelNames: ['api'],
});

Expand Down
26 changes: 13 additions & 13 deletions server/exporters/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,38 @@ collectDefaultMetrics({
});

const guageCPULoad1m = new client.Gauge({
name: 'load_duration_1m',
name: 'CPU_Load_1m',
help: 'Average Load duration 1m',
});

const guageCPULoad5m = new client.Gauge({
name: 'load_duration_5m',
help: 'Average Load duration 5m',
name: 'CPU_Load_5m',
help: 'Average Load 5m',
});

const guageCPULoad15m = new client.Gauge({
name: 'load_duration_15m',
help: 'Average Load duration 15m',
name: 'CPU_Load_15m',
help: 'Average Load 15m',
});

const guageCPUsage = new client.Gauge({
name: 'cpu_average_usage',
help: 'CPU usage percentage',
name: 'CPU_Average_Usage',
help: '(%)',
});

const guageMemoryUsage = new client.Gauge({
name: 'memory_usage',
help: 'Memory usage percentage',
name: 'Memory_Usage',
help: '(%)',
});

const guageDiskRead = new client.Gauge({
name: 'disk_read_average_time',
help: 'Disk read average time per I/O (ms)',
name: 'Disk_Read_Average_Time',
help: '(ms)',
labelNames: ['device'],
});
const guageDiskWrite = new client.Gauge({
name: 'disk_write_average_time',
help: 'Disk write average time per I/O (ms)',
name: 'Disk_Write_Average_Time',
help: '(ms)',
labelNames: ['device'],
});

Expand Down

0 comments on commit 192212f

Please sign in to comment.