SDK Setup
Node.js SDK
Install and configure the Argus Node.js SDK.
Installation
npm install @argus/sdkQuick Start
import { ArgusClient } from '@argus/sdk';
const client = new ArgusClient({
apiKey: 'your-api-key',
endpoint: 'https://api.tryargus.cloud'
});
// Start automatic metric collection
client.start();Sending Custom Metrics
await client.ingest({
host: 'web-server-01',
metrics: {
cpu_percent: 42.5,
memory_percent: 68.2,
request_count: 1847
},
tags: {
environment: 'production',
service: 'api'
}
});Webhook Handler
The Node.js SDK includes an Express middleware for handling webhook events:
import { createArgusHandler } from '@argus/sdk';
import express from 'express';
const app = express();
const argusHandler = createArgusHandler({
secret: 'your-webhook-secret',
tools: {
restart_service: async (params) => {
// Handle restart
return { success: true };
},
scale_up: async (params) => {
// Handle scaling
return { success: true };
}
}
});
app.use('/argus/webhook', argusHandler);Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | Required | Your Argus API key |
endpoint | string | https://api.tryargus.cloud | Argus API endpoint |
interval | number | 60 | Collection interval in seconds |
collectDocker | boolean | true | Collect Docker metrics |
collectProcesses | boolean | true | Collect process metrics |