@porosys/ndtool
Version:
Netdata alert and automation tool
20 lines (19 loc) • 784 B
JavaScript
import fs from 'fs-extra';
import chalk from 'chalk';
export const createHealthAlarmNotifyConf = async () => {
const sourcePath = '/opt/netdata/usr/lib/netdata/conf.d/health_alarm_notify.conf';
const targetPath = '/opt/netdata/etc/netdata/health_alarm_notify.conf';
try {
if (!(await fs.pathExists(sourcePath))) {
throw new Error(`Source file not found: ${sourcePath}`);
}
await fs.ensureDir('/opt/netdata/etc/netdata/');
await fs.copy(sourcePath, targetPath);
console.log(chalk.green(`✅ Created health_alarm_notify.conf at ${targetPath}`));
return targetPath;
}
catch (error) {
console.error(chalk.red(`❌ Failed to create health_alarm_notify.conf: ${error}`));
throw error;
}
};