https://signoz.io logo
#support
Title
# support
a

Aboubakr LACHHAB

05/20/2022, 10:19 AM
Hi 👋👋 Thanks for this amazing APM 👊 I want to monitoring NodeJs server (CPU, Memory... ) other than where signoz is installed, and as @Prashant Shahi proposed, I added OpenTelemetry to my ./tracing.js with configuration sending hostmetrics to SigNoz Otel OTLP . and this is my code:
Copy code
// tracing.js
'use strict'
const process = require('process');
const opentelemetry = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc');
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { HostMetrics } = require('@opentelemetry/host-metrics');
const { OTLPMetricExporter } =  require('@opentelemetry/exporter-metrics-otlp-grpc');
    
const traceExporter = new OTLPTraceExporter();
const sdk = new opentelemetry.NodeSDK({
  traceExporter,
  instrumentations: [getNodeAutoInstrumentations()]
  });
   
  sdk.start()
  .then(() => console.log('Tracing initialized',traceExporter))
  .catch((error) => console.log('Error initializing tracing', error));
  
   process.on('SIGTERM', () => {
    sdk.shutdown()
    .then(() => console.log('Tracing terminated'))
    .catch((error) => console.log('Error terminating tracing', error))
    .finally(() => process.exit(0));
    });
    
    const collectorOptions = {
      // url is optional and can be omitted - default is <grpc://localhost:4317>
      url: 'grpc://<my IP>:4317',
    };
    const exporter = new OTLPMetricExporter(collectorOptions);
    
    
    const meterProvider = new MeterProvider({
      exporter,
      interval: 2000,
    });
    
    const hostMetrics = new HostMetrics({ meterProvider, name: 'example-host-metrics' });

    hostMetrics.start();
and in my dashpoard I used example-host-metrics as PromQL Query. I think I miss something, but I'm not sure what NP : I tested custom-metrics-examples/nodejs/ exemple, and it work well
p

Pranay

05/20/2022, 11:23 AM
@Aboubakr LACHHAB welcome to SigNoz community👋 How are you generating host metrics in this machine?
a

Aboubakr LACHHAB

05/20/2022, 11:27 AM
thanks @Pranay I used HostMetrics from @opentelemetry/host-metrics. and if I choose exporter : new ConsoleMetricExporter(), it return in the console the next results:
Copy code
{
  name: 'system.cpu.utilization',
  description: 'Cpu usage time 0-1',
  unit: '1',
  metricKind: 5,
  valueType: 1
}
{ state: 'nice', cpu: '3' }
value: 0
{
  name: 'system.memory.usage',
  description: 'Memory usage in bytes',
  unit: '1',
  metricKind: 4,
  valueType: 1
}
{ state: 'used' }
value: 7360823296
p

Pranay

05/20/2022, 11:33 AM
ok, can you follow theses steps to find metrics which are available in SIgNoz - https://signoz.io/docs/userguide/send-metrics/#find-metrics-available-in-signoz and then try plotting them on the dashboard
a

Aboubakr LACHHAB

05/20/2022, 1:29 PM
thanks @Pranay so I should Install Clickhouse client in each server I want to monitoring it CPU, Memory... (other than where signoz is installed,)
if we use the same PromQL Query (system_memory_usage_total, system_cpu_time ...) for the metrics of all servers, how we can make deference between metrics of each server?
4 Views