Files
server-monitor-xp/src/control/gather.js
2019-09-02 14:14:55 +08:00

31 lines
697 B
JavaScript

import os from 'os'
import axios from 'axios'
import { execSync } from 'child_process'
const request = axios.create()
export default async (conf) => {
const gather = (conf) => {
setTimeout(async () => {
const who = execSync('whoami')
const { version, apiURLs, AGENT_VERSION } = conf
const { data } = await request.put(apiURLs.apiURL + 'gather', {
version,
AGENT_VERSION,
user: who.toString('utf8').trim('\r\n'),
arch: os.arch(),
type: os.type(),
platform: os.platform()
})
if (data.status === 1) {
console.log('发现监控系统地址')
}
gather(conf)
}, 20000)
}
gather(conf)
}