statistics: always refetch ClamAV version

also better display when not using ClamAV
This commit is contained in:
Bobby Wibowo 2020-11-02 18:23:23 +07:00
parent d4a3ebbc58
commit db2897fbe6
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -631,6 +631,15 @@ self.stats = async (req, res, next) => {
const time = si.time()
const nodeUptime = process.uptime()
if (self.clamscan.instance) {
try {
self.clamscan.version = await self.clamscan.instance.get_version().then(s => s.trim())
} catch (error) {
logger.error(error)
self.clamscan.version = 'Errored when querying version.'
}
}
stats.system = {
_types: {
byte: ['memoryUsage'],
@ -640,7 +649,7 @@ self.stats = async (req, res, next) => {
platform: `${os.platform} ${os.arch}`,
distro: `${os.distro} ${os.release}`,
kernel: os.kernel,
scanner: self.clamscan.version,
scanner: self.clamscan.version || 'N/A',
cpuLoad: `${currentLoad.currentload.toFixed(1)}%`,
cpusLoad: currentLoad.cpus.map(cpu => `${cpu.load.toFixed(1)}%`).join(', '),
systemMemory: {