InfraHub
26 строк · 617.0 Байт
1import React, { useEffect, useState } from 'react';2import axios from 'axios';3
4const ServerStatus = () => {5const [status, setStatus] = useState({});6
7useEffect(() => {8axios.get('/api/server-status')9.then(response => setStatus(response.data))10.catch(error => console.error(error));11}, []);12
13return (14<div>15<h2>Server Status</h2>16<ul>17<li>CPU Usage: {status.cpu}%</li>18<li>Memory Usage: {status.memory}%</li>19<li>Traffic: {status.traffic} MB</li>20{/* Add more status indicators */}21</ul>22</div>23);24};25
26export default ServerStatus;27