UNPKG

@porosys/pss

Version:

Porosys Server Setup (pss): General-purpose server setup and automation tool (including Netdata management)

60 lines (54 loc) 1.78 kB
#!/usr/bin/env node import { netdataInstallCommand } from '../lib/netdata/commands/install/netdata-install.command'; import { netdataConfigCommand } from '../lib/netdata/commands/netdata-config.command'; import { netdataRestartCommand } from '../lib/netdata/commands/netdata-restart.command'; import { netdataAddAlertCommand } from '../lib/netdata/commands/netdata-add-alert.command'; import { netdataUninstallCommand } from '../lib/netdata/commands/netdata-uninstall.command'; import { dbBlockAttackersCommand } from '../lib/db/commands/db-block-attackers/db-block-attackers.command'; async function main() { const [,, group, subcommand] = process.argv; if (!group || !subcommand) { printHelp(); return; } if (group === 'netdata') { switch (subcommand) { case 'install': await netdataInstallCommand(); break; case 'config': await netdataConfigCommand(); break; case 'restart': await netdataRestartCommand(); break; case 'add-alert': await netdataAddAlertCommand(); break; case 'uninstall': await netdataUninstallCommand(); break; default: printHelp(); } } else if (group === 'db') { switch (subcommand) { case 'block-attackers': await dbBlockAttackersCommand(); break; default: printHelp(); } } else { printHelp(); } } function printHelp() { console.log('Usage: pss <group> <command>'); console.log('Groups: netdata | db'); console.log('Netdata Commands: install | uninstall | restart | config | add-alert'); console.log('DB Commands: block-attackers'); console.log('Example: pss netdata install'); console.log('Example: pss db block-attackers'); } void main();