Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
pulling data on Zabbix api with node express app

I am trying to use Zabbix API to pull somedata. I use it in a node app using express and zabbix node. My main problem is that When I want to print any variable using console.log, it gives me undefined. I don't understand why? (I'm sure that my login username, password and server address are right)

My code is :

var express = require("express");
var fs = require('fs');
var app = express();
var Zabbix = require ("zabbix-node");

app.get('/', function (req, res) {
  var zabbix = new Zabbix('XXXX','XXX', 'XXX');

  zabbix.getApiVersion(function (err, resp, body) {
      if (!err) {
        console.log("Unauthenticated API version request, and the version is: " + body.result)
      }
  });

  zabbix.login(function (err, resp, body) {
    if (!err) {
      console.log("Authenticated! AuthID is: " + zabbix.authid);
    }


    zabbix.getApiVersion(function (err, resp, body) {
        console.log("Zabbix API version is: " + body.result);     
    });

  });

});
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Try to console.log body (not body.result);

console.log(body) 
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!