Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getSystemInformation = async () => {
return {
system: await systemInfo.system(),
time: systemInfo.time(),
cpu: await systemInfo.cpu(),
osInfo: await systemInfo.osInfo(),
package: {
name: pkg.name,
version: pkg.version,
repository: pkg.repository,
author: pkg.author,
"staart-version": pkg["staart-version"]
}
};
};
exports.systemInfo = async function (cb) {
try {
cb({
cpu: await si.cpu(),
time: si.time(),
memory: await si.mem(),
system: await si.osInfo(),
versions: await si.versions(),
fs: await si.fsSize(),
load: await si.currentLoad(),
processes: await si.processes(),
network: {
interfaces: await si.networkInterfaces(),
stats: await si.networkStats(),
connections: await si.networkConnections()
},
process: {
uptime: process.uptime(),
version: process.version,
memoryUsage: process.memoryUsage(),
cpuUsage: process.cpuUsage()
title: body.slug,
description: `[Status for build #${body.last_build_number}](http://travis-ci.org/Aceheliflyer/AceBot/builds/${body.last_build_id})`,
fields: [
{
'name': 'Build Result',
'value': buildResult[body.last_build_result],
'inline': true
},
{
'name': 'Build Duration',
'value': `Ran for ${moment.duration(body.last_build_duration * 1000).format('y [yr,] M [mo,] w [wk,] d [day,] h [hr,] m [min, and] s [sec]')}`,
'inline': true
},
{
'name': 'Last Build',
'value': `${moment(body.last_build_started_at).format('llll')} ${si.time().timezone})`,
'inline': false
}
],
color: buildResultColor[body.last_build_result]
})
}
})
}
const getSystemInformation = async () => {
return {
system: await systemInfo.system(),
time: systemInfo.time(),
cpu: await systemInfo.cpu(),
osInfo: await systemInfo.osInfo(),
package: {
name: pkg.name,
version: pkg.version,
repository: pkg.repository,
author: pkg.author,
"staart-version": pkg["staart-version"]
}
};
};
if (disposableDomains.includes(domain)) throw new Error(DISPOSABLE_EMAIL);
const potentialMatches = wildcardDomains.filter(w => domain.includes(w));
potentialMatches.forEach(
d => (isDisposable = isDisposable || isMatch(email, `*.${d}`))
);
if (isDisposable) throw new Error(DISPOSABLE_EMAIL);
return;
};
sendMail({
from: SES_EMAIL,
to: TEST_EMAIL,
subject: "Test from Staart",
message: `This is an example email to test your Staart email configuration.\n\n${JSON.stringify(
{
time: systemInfo.time(),
package: {
name: pkg.name,
version: pkg.version,
repository: pkg.repository,
author: pkg.author,
"staart-version": pkg["staart-version"]
}
}
)}`
})
.then(() => {})
.catch(() =>
logError("Invalid email config", "Could not send a test email", 1)
);
model: system.model
},
cpu: {
manufacturer: cpu.manufacturer,
brand: cpu.brand,
cores: cpu.cores
},
os: {
distro: os.distro,
hostname: os.hostname
},
interval: argv.i
};
ctx.body = {
iterID: iterID,
uptime: SI.time().uptime,
cpuTemp: Math.max(...cpuTemp.cores),
cpuLoad: Math.round(cpuLoad.currentload),
mem: {
total: Math.round(mem.total / 1024 / 1024),
active: Math.round(mem.active / 1024 / 1024),
swaptotal: Math.round(mem.swaptotal / 1024 / 1024),
swapused: Math.round(mem.swapused / 1024 / 1024)
},
processes: processes.all,
disk: disk.map(disk => ({
size: Math.round(+disk.size / 1024 / 1024 / 1024),
used: Math.round(+disk.used / 1024 / 1024 / 1024)
})),
disksIO: {
rbps: Math.round(fsStats.rx_sec / 1024),
wbps: Math.round(fsStats.wx_sec / 1024),