@irsyadulibad/servermon 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.ts +32 -4
- package/package.json +1 -1
package/cli.ts
CHANGED
|
@@ -29,14 +29,42 @@ async function interactiveSetup(): Promise<void> {
|
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
console.log();
|
|
33
|
+
console.log("⏱ Choose report interval:");
|
|
34
|
+
console.log(" 1. Every 5 minutes");
|
|
35
|
+
console.log(" 2. Every 1 hour");
|
|
36
|
+
console.log(" 3. Every 3 hours");
|
|
37
|
+
console.log(" 4. Every 6 hours");
|
|
38
|
+
console.log(" 5. Every 12 hours");
|
|
39
|
+
console.log(" 6. Custom (in seconds)");
|
|
40
|
+
|
|
41
|
+
const choice = prompt(" Pick [1-6] (default: 1): ")?.trim() || "1";
|
|
42
|
+
|
|
43
|
+
const intervals: Record<string, number> = {
|
|
44
|
+
"1": 300,
|
|
45
|
+
"2": 3600,
|
|
46
|
+
"3": 10800,
|
|
47
|
+
"4": 21600,
|
|
48
|
+
"5": 43200,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
let interval: number;
|
|
52
|
+
if (choice === "6") {
|
|
53
|
+
const custom = prompt(" Enter interval in seconds: ")?.trim();
|
|
54
|
+
interval = Math.max(30, parseInt(custom || "300") || 300);
|
|
55
|
+
} else {
|
|
56
|
+
interval = intervals[choice] ?? 300;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const label =
|
|
60
|
+
interval >= 3600
|
|
61
|
+
? `${(interval / 3600).toFixed(0)} hour(s)`
|
|
62
|
+
: `${(interval / 60).toFixed(0)} min`;
|
|
35
63
|
|
|
36
64
|
await saveConfig({ token, interval });
|
|
37
65
|
console.log(`\n✅ Config saved!`);
|
|
38
66
|
console.log(` 📁 ${configPath()}`);
|
|
39
|
-
console.log(` ⏱ Interval: ${interval}s (${
|
|
67
|
+
console.log(` ⏱ Interval: ${interval}s (${label})`);
|
|
40
68
|
console.log(`\n📡 Next step: DM your bot once on Telegram, then re-run \`servermon\`.`);
|
|
41
69
|
}
|
|
42
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@irsyadulibad/servermon",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Lightweight server monitoring daemon — collects system metrics and sends structured reports to Telegram. Built with Bun + TypeScript.",
|
|
5
5
|
"module": "index.ts",
|
|
6
6
|
"type": "module",
|