@sonde/packs 0.1.1 → 0.1.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.
Files changed (161) hide show
  1. package/.turbo/turbo-build.log +4 -6
  2. package/.turbo/turbo-test.log +57 -814
  3. package/CHANGELOG.md +18 -0
  4. package/dist/docker/manifest (# Edit conflict 2026-02-19 LIl7ilN #).js +54 -0
  5. package/dist/index.d.ts +9 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +9 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/integrations/a10.d.ts +3 -0
  10. package/dist/integrations/a10.d.ts.map +1 -0
  11. package/dist/integrations/a10.js +218 -0
  12. package/dist/integrations/a10.js.map +1 -0
  13. package/dist/integrations/checkpoint.d.ts +3 -0
  14. package/dist/integrations/checkpoint.d.ts.map +1 -0
  15. package/dist/integrations/checkpoint.js +249 -0
  16. package/dist/integrations/checkpoint.js.map +1 -0
  17. package/dist/integrations/citrix.d.ts.map +1 -1
  18. package/dist/integrations/citrix.js +14 -19
  19. package/dist/integrations/citrix.js.map +1 -1
  20. package/dist/integrations/citrix.test.js +3 -3
  21. package/dist/integrations/citrix.test.js.map +1 -1
  22. package/dist/integrations/datadog.d.ts +3 -0
  23. package/dist/integrations/datadog.d.ts.map +1 -0
  24. package/dist/integrations/datadog.js +195 -0
  25. package/dist/integrations/datadog.js.map +1 -0
  26. package/dist/integrations/graph.d.ts.map +1 -1
  27. package/dist/integrations/graph.js +10 -15
  28. package/dist/integrations/graph.js.map +1 -1
  29. package/dist/integrations/graph.test.js +3 -3
  30. package/dist/integrations/graph.test.js.map +1 -1
  31. package/dist/integrations/httpbin.d.ts.map +1 -1
  32. package/dist/integrations/httpbin.js +2 -7
  33. package/dist/integrations/httpbin.js.map +1 -1
  34. package/dist/integrations/jira.d.ts +3 -0
  35. package/dist/integrations/jira.d.ts.map +1 -0
  36. package/dist/integrations/jira.js +199 -0
  37. package/dist/integrations/jira.js.map +1 -0
  38. package/dist/integrations/loki.d.ts +3 -0
  39. package/dist/integrations/loki.d.ts.map +1 -0
  40. package/dist/integrations/loki.js +178 -0
  41. package/dist/integrations/loki.js.map +1 -0
  42. package/dist/integrations/meraki.d.ts +3 -0
  43. package/dist/integrations/meraki.d.ts.map +1 -0
  44. package/dist/integrations/meraki.js +238 -0
  45. package/dist/integrations/meraki.js.map +1 -0
  46. package/dist/integrations/nutanix.d.ts.map +1 -1
  47. package/dist/integrations/nutanix.js +12 -17
  48. package/dist/integrations/nutanix.js.map +1 -1
  49. package/dist/integrations/nutanix.test.js +3 -3
  50. package/dist/integrations/nutanix.test.js.map +1 -1
  51. package/dist/integrations/pagerduty.d.ts +3 -0
  52. package/dist/integrations/pagerduty.d.ts.map +1 -0
  53. package/dist/integrations/pagerduty.js +229 -0
  54. package/dist/integrations/pagerduty.js.map +1 -0
  55. package/dist/integrations/proxmox.d.ts.map +1 -1
  56. package/dist/integrations/proxmox.js +8 -13
  57. package/dist/integrations/proxmox.js.map +1 -1
  58. package/dist/integrations/proxmox.test.js +3 -3
  59. package/dist/integrations/proxmox.test.js.map +1 -1
  60. package/dist/integrations/servicenow.d.ts.map +1 -1
  61. package/dist/integrations/servicenow.js +10 -16
  62. package/dist/integrations/servicenow.js.map +1 -1
  63. package/dist/integrations/servicenow.test.js +3 -3
  64. package/dist/integrations/servicenow.test.js.map +1 -1
  65. package/dist/integrations/splunk.d.ts.map +1 -1
  66. package/dist/integrations/splunk.js +8 -13
  67. package/dist/integrations/splunk.js.map +1 -1
  68. package/dist/integrations/splunk.test.js +3 -3
  69. package/dist/integrations/splunk.test.js.map +1 -1
  70. package/dist/integrations/thousandeyes.d.ts +3 -0
  71. package/dist/integrations/thousandeyes.d.ts.map +1 -0
  72. package/dist/integrations/thousandeyes.js +263 -0
  73. package/dist/integrations/thousandeyes.js.map +1 -0
  74. package/dist/integrations/vcenter.d.ts +3 -0
  75. package/dist/integrations/vcenter.d.ts.map +1 -0
  76. package/dist/integrations/vcenter.js +190 -0
  77. package/dist/integrations/vcenter.js.map +1 -0
  78. package/dist/proxmox/probes/ceph-status.test.d.ts (# Edit conflict 2026-02-19 N25hAvJ #).map +1 -0
  79. package/dist/system/index.d.ts.map +1 -1
  80. package/dist/system/index.js +10 -0
  81. package/dist/system/index.js.map +1 -1
  82. package/dist/system/manifest.d.ts.map +1 -1
  83. package/dist/system/manifest.js +100 -3
  84. package/dist/system/manifest.js.map +1 -1
  85. package/dist/system/probes/logs-dmesg.d.ts +13 -0
  86. package/dist/system/probes/logs-dmesg.d.ts.map +1 -0
  87. package/dist/system/probes/logs-dmesg.js +22 -0
  88. package/dist/system/probes/logs-dmesg.js.map +1 -0
  89. package/dist/system/probes/logs-dmesg.test.d.ts +2 -0
  90. package/dist/system/probes/logs-dmesg.test.d.ts.map +1 -0
  91. package/dist/system/probes/logs-dmesg.test.js +55 -0
  92. package/dist/system/probes/logs-dmesg.test.js.map +1 -0
  93. package/dist/system/probes/logs-journal.d.ts +21 -0
  94. package/dist/system/probes/logs-journal.d.ts.map +1 -0
  95. package/dist/system/probes/logs-journal.js +70 -0
  96. package/dist/system/probes/logs-journal.js.map +1 -0
  97. package/dist/system/probes/logs-journal.test.d.ts +2 -0
  98. package/dist/system/probes/logs-journal.test.d.ts.map +1 -0
  99. package/dist/system/probes/logs-journal.test.js +113 -0
  100. package/dist/system/probes/logs-journal.test.js.map +1 -0
  101. package/dist/system/probes/logs-tail.d.ts +14 -0
  102. package/dist/system/probes/logs-tail.d.ts.map +1 -0
  103. package/dist/system/probes/logs-tail.js +40 -0
  104. package/dist/system/probes/logs-tail.js.map +1 -0
  105. package/dist/system/probes/logs-tail.test.d.ts +2 -0
  106. package/dist/system/probes/logs-tail.test.d.ts.map +1 -0
  107. package/dist/system/probes/logs-tail.test.js +82 -0
  108. package/dist/system/probes/logs-tail.test.js.map +1 -0
  109. package/dist/system/probes/ping.d.ts +20 -0
  110. package/dist/system/probes/ping.d.ts.map +1 -0
  111. package/dist/system/probes/ping.js +54 -0
  112. package/dist/system/probes/ping.js.map +1 -0
  113. package/dist/system/probes/ping.test.d.ts +2 -0
  114. package/dist/system/probes/ping.test.d.ts.map +1 -0
  115. package/dist/system/probes/ping.test.js +127 -0
  116. package/dist/system/probes/ping.test.js.map +1 -0
  117. package/dist/system/probes/traceroute.d.ts +17 -0
  118. package/dist/system/probes/traceroute.d.ts.map +1 -0
  119. package/dist/system/probes/traceroute.js +72 -0
  120. package/dist/system/probes/traceroute.js.map +1 -0
  121. package/dist/system/probes/traceroute.test.d.ts +2 -0
  122. package/dist/system/probes/traceroute.test.d.ts.map +1 -0
  123. package/dist/system/probes/traceroute.test.js +98 -0
  124. package/dist/system/probes/traceroute.test.js.map +1 -0
  125. package/package.json +1 -1
  126. package/src/index.ts +9 -0
  127. package/src/integrations/a10.ts +370 -0
  128. package/src/integrations/checkpoint.ts +381 -0
  129. package/src/integrations/citrix.test.ts +3 -3
  130. package/src/integrations/citrix.ts +17 -21
  131. package/src/integrations/datadog.ts +281 -0
  132. package/src/integrations/graph.test.ts +3 -3
  133. package/src/integrations/graph.ts +10 -14
  134. package/src/integrations/httpbin.ts +2 -6
  135. package/src/integrations/jira.ts +272 -0
  136. package/src/integrations/loki.ts +228 -0
  137. package/src/integrations/meraki.ts +344 -0
  138. package/src/integrations/nutanix.test.ts +3 -3
  139. package/src/integrations/nutanix.ts +13 -17
  140. package/src/integrations/pagerduty.ts +319 -0
  141. package/src/integrations/proxmox.test.ts +3 -3
  142. package/src/integrations/proxmox.ts +8 -12
  143. package/src/integrations/servicenow.test.ts +3 -3
  144. package/src/integrations/servicenow.ts +10 -15
  145. package/src/integrations/splunk.test.ts +3 -3
  146. package/src/integrations/splunk.ts +9 -13
  147. package/src/integrations/thousandeyes.ts +353 -0
  148. package/src/integrations/vcenter.ts +261 -0
  149. package/src/system/index.ts +10 -0
  150. package/src/system/manifest.ts +113 -3
  151. package/src/system/probes/logs-dmesg.test.ts +83 -0
  152. package/src/system/probes/logs-dmesg.ts +38 -0
  153. package/src/system/probes/logs-journal.test.ts +142 -0
  154. package/src/system/probes/logs-journal.ts +103 -0
  155. package/src/system/probes/logs-tail.test.ts +140 -0
  156. package/src/system/probes/logs-tail.ts +70 -0
  157. package/src/system/probes/ping.test.ts +163 -0
  158. package/src/system/probes/ping.ts +89 -0
  159. package/src/system/probes/traceroute.test.ts +149 -0
  160. package/src/system/probes/traceroute.ts +99 -0
  161. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,149 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import type { ExecFn } from '../../types.js';
3
+ import type { TracerouteResult } from './traceroute.js';
4
+ import {
5
+ parseTracerouteOutput,
6
+ traceroute,
7
+ } from './traceroute.js';
8
+
9
+ const LINUX_TRACEROUTE = `traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
10
+ 1 192.168.1.1 1.234 ms 1.100 ms 1.050 ms
11
+ 2 10.0.0.1 5.432 ms 5.300 ms 5.200 ms
12
+ 3 * * *
13
+ 4 172.16.0.1 15.678 ms 15.500 ms 15.400 ms
14
+ 5 8.8.8.8 20.123 ms 20.050 ms 19.900 ms`;
15
+
16
+ const MACOS_TRACEROUTE = `traceroute to 1.1.1.1 (1.1.1.1), 30 hops max, 60 byte packets
17
+ 1 192.168.0.1 2.345 ms 2.100 ms 2.050 ms
18
+ 2 * * *
19
+ 3 1.1.1.1 10.567 ms 10.400 ms 10.300 ms`;
20
+
21
+ const ALL_TIMEOUT = `traceroute to 10.0.0.99 (10.0.0.99), 5 hops max, 60 byte packets
22
+ 1 * * *
23
+ 2 * * *
24
+ 3 * * *`;
25
+
26
+ describe('parseTracerouteOutput', () => {
27
+ it('parses Linux traceroute with mixed hops', () => {
28
+ const result = parseTracerouteOutput(
29
+ LINUX_TRACEROUTE,
30
+ '8.8.8.8',
31
+ );
32
+
33
+ expect(result.host).toBe('8.8.8.8');
34
+ expect(result.hops).toHaveLength(5);
35
+
36
+ // Hop 1: normal response
37
+ expect(result.hops[0]?.hop).toBe(1);
38
+ expect(result.hops[0]?.ip).toBe('192.168.1.1');
39
+ expect(result.hops[0]?.rttMs).toEqual([1.234, 1.1, 1.05]);
40
+
41
+ // Hop 3: all timeouts
42
+ expect(result.hops[2]?.hop).toBe(3);
43
+ expect(result.hops[2]?.ip).toBeNull();
44
+ expect(result.hops[2]?.rttMs).toEqual([null, null, null]);
45
+
46
+ // Hop 5: destination
47
+ expect(result.hops[4]?.hop).toBe(5);
48
+ expect(result.hops[4]?.ip).toBe('8.8.8.8');
49
+ expect(result.hops[4]?.rttMs).toEqual([20.123, 20.05, 19.9]);
50
+ });
51
+
52
+ it('parses macOS traceroute output', () => {
53
+ const result = parseTracerouteOutput(
54
+ MACOS_TRACEROUTE,
55
+ '1.1.1.1',
56
+ );
57
+
58
+ expect(result.host).toBe('1.1.1.1');
59
+ expect(result.hops).toHaveLength(3);
60
+ expect(result.hops[0]?.ip).toBe('192.168.0.1');
61
+ expect(result.hops[1]?.ip).toBeNull();
62
+ expect(result.hops[2]?.ip).toBe('1.1.1.1');
63
+ });
64
+
65
+ it('handles all-timeout output', () => {
66
+ const result = parseTracerouteOutput(
67
+ ALL_TIMEOUT,
68
+ '10.0.0.99',
69
+ );
70
+
71
+ expect(result.hops).toHaveLength(3);
72
+ for (const hop of result.hops) {
73
+ expect(hop.ip).toBeNull();
74
+ expect(hop.rttMs).toEqual([null, null, null]);
75
+ }
76
+ });
77
+
78
+ it('handles empty output', () => {
79
+ const result = parseTracerouteOutput('', '8.8.8.8');
80
+ expect(result.hops).toHaveLength(0);
81
+ });
82
+ });
83
+
84
+ describe('traceroute handler', () => {
85
+ it('throws when host is missing', async () => {
86
+ const mockExec: ExecFn = async () => '';
87
+ await expect(
88
+ traceroute(undefined, mockExec),
89
+ ).rejects.toThrow('Missing required parameter: host');
90
+ await expect(
91
+ traceroute({}, mockExec),
92
+ ).rejects.toThrow('Missing required parameter: host');
93
+ });
94
+
95
+ it('passes correct args with defaults', async () => {
96
+ const calls: Array<{ cmd: string; args: string[] }> = [];
97
+ const mockExec: ExecFn = async (cmd, args) => {
98
+ calls.push({ cmd, args });
99
+ return LINUX_TRACEROUTE;
100
+ };
101
+
102
+ const result = (await traceroute(
103
+ { host: '8.8.8.8' },
104
+ mockExec,
105
+ )) as TracerouteResult;
106
+
107
+ expect(calls).toHaveLength(1);
108
+ expect(calls[0]?.cmd).toBe('traceroute');
109
+ expect(calls[0]?.args).toEqual([
110
+ '-n', '-m', '30', '-w', '2', '8.8.8.8',
111
+ ]);
112
+ expect(result.host).toBe('8.8.8.8');
113
+ expect(result.hops).toHaveLength(5);
114
+ });
115
+
116
+ it('respects custom maxHops', async () => {
117
+ const calls: Array<{ cmd: string; args: string[] }> = [];
118
+ const mockExec: ExecFn = async (cmd, args) => {
119
+ calls.push({ cmd, args });
120
+ return '';
121
+ };
122
+
123
+ await traceroute(
124
+ { host: '8.8.8.8', maxHops: 10 },
125
+ mockExec,
126
+ );
127
+ expect(calls[0]?.args).toContain('10');
128
+ });
129
+
130
+ it('clamps maxHops to valid range', async () => {
131
+ const calls: Array<{ cmd: string; args: string[] }> = [];
132
+ const mockExec: ExecFn = async (cmd, args) => {
133
+ calls.push({ cmd, args });
134
+ return '';
135
+ };
136
+
137
+ await traceroute(
138
+ { host: '8.8.8.8', maxHops: 999 },
139
+ mockExec,
140
+ );
141
+ expect(calls[0]?.args).toContain('64');
142
+
143
+ await traceroute(
144
+ { host: '8.8.8.8', maxHops: 0 },
145
+ mockExec,
146
+ );
147
+ expect(calls[1]?.args).toContain('1');
148
+ });
149
+ });
@@ -0,0 +1,99 @@
1
+ import type { ProbeHandler } from '../../types.js';
2
+
3
+ export interface TracerouteHop {
4
+ hop: number;
5
+ ip: string | null;
6
+ rttMs: (number | null)[];
7
+ }
8
+
9
+ export interface TracerouteResult {
10
+ host: string;
11
+ hops: TracerouteHop[];
12
+ }
13
+
14
+ /**
15
+ * Traces the network path to a host via `traceroute -n`.
16
+ * Works on both Linux and macOS.
17
+ */
18
+ export const traceroute: ProbeHandler = async (params, exec) => {
19
+ const host = params?.host as string | undefined;
20
+ if (!host) {
21
+ throw new Error('Missing required parameter: host');
22
+ }
23
+
24
+ const maxHops = Math.min(
25
+ Math.max(Number(params?.maxHops ?? 30), 1),
26
+ 64,
27
+ );
28
+
29
+ const output = await exec('traceroute', [
30
+ '-n',
31
+ '-m',
32
+ String(maxHops),
33
+ '-w',
34
+ '2',
35
+ host,
36
+ ]);
37
+
38
+ return parseTracerouteOutput(output, host);
39
+ };
40
+
41
+ export function parseTracerouteOutput(
42
+ raw: string,
43
+ host: string,
44
+ ): TracerouteResult {
45
+ const hops: TracerouteHop[] = [];
46
+ const lines = raw.trim().split('\n');
47
+
48
+ for (const line of lines) {
49
+ // Skip the header line ("traceroute to ...")
50
+ const hopMatch = line.match(/^\s*(\d+)\s+(.+)/);
51
+ if (!hopMatch) continue;
52
+
53
+ const hopNum = Number(hopMatch[1]);
54
+ const rest = hopMatch[2] ?? '';
55
+
56
+ // All probes timed out: "* * *"
57
+ if (/^\*\s+\*\s+\*\s*$/.test(rest)) {
58
+ hops.push({ hop: hopNum, ip: null, rttMs: [null, null, null] });
59
+ continue;
60
+ }
61
+
62
+ const hop = parseHopLine(hopNum, rest);
63
+ hops.push(hop);
64
+ }
65
+
66
+ return { host, hops };
67
+ }
68
+
69
+ function parseHopLine(hopNum: number, rest: string): TracerouteHop {
70
+ let ip: string | null = null;
71
+ const rttMs: (number | null)[] = [];
72
+
73
+ // Tokenize the rest of the line
74
+ const tokens = rest.trim().split(/\s+/);
75
+ let i = 0;
76
+ while (i < tokens.length) {
77
+ const token = tokens[i];
78
+
79
+ if (!token || token === '*') {
80
+ rttMs.push(null);
81
+ i++;
82
+ } else if (token === 'ms') {
83
+ // Skip "ms" — already consumed the number
84
+ i++;
85
+ } else if (/^\d+\.\d+\.\d+\.\d+$/.test(token) || token.includes(':')) {
86
+ // IPv4 or IPv6 address
87
+ ip = token;
88
+ i++;
89
+ } else {
90
+ const num = Number.parseFloat(token);
91
+ if (!Number.isNaN(num)) {
92
+ rttMs.push(num);
93
+ }
94
+ i++;
95
+ }
96
+ }
97
+
98
+ return { hop: hopNum, ip, rttMs };
99
+ }