forked from cerc-io/laconic-console
More logging, and service info tab.
This commit is contained in:
@@ -17,6 +17,7 @@ type Query {
|
||||
app_status: JSONResult!
|
||||
ipfs_status: JSONResult!
|
||||
ipfs_swarm_status: JSONResult!
|
||||
service_status: JSONResult!
|
||||
signal_status: JSONResult!
|
||||
system_status: JSONResult!
|
||||
wns_status: JSONResult!
|
||||
|
||||
@@ -6,6 +6,7 @@ import moment from 'moment';
|
||||
import pick from 'lodash.pick';
|
||||
import os from 'os';
|
||||
import si from 'systeminformation';
|
||||
import { spawnSync } from "child_process";
|
||||
|
||||
const num = new Intl.NumberFormat('en', { maximumSignificantDigits: 3 });
|
||||
|
||||
@@ -77,6 +78,18 @@ const getSystemInfo = async () => {
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Get system inforamtion.
|
||||
* https://www.npmjs.com/package/systeminformation
|
||||
*/
|
||||
const getServiceInfo = async () => {
|
||||
const command = 'wire';
|
||||
const args = ['service', '--json'];
|
||||
|
||||
const child = spawnSync(command, args, { encoding: 'utf8' });
|
||||
return child.stdout;
|
||||
}
|
||||
|
||||
export const systemResolvers = {
|
||||
Query: {
|
||||
system_status: async () => {
|
||||
@@ -86,6 +99,14 @@ export const systemResolvers = {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify(system)
|
||||
};
|
||||
}
|
||||
},
|
||||
service_status: async () => {
|
||||
const serviceInfo = await getServiceInfo();
|
||||
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify(serviceInfo)
|
||||
};
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user