I am trying to use Zabbix API to pull somedata. I use in a node app using express and zabbix node (https://libraries.io/npm/zabbix-node). My main problem is that all the var in console.log are undefined. I don't understand why ? ( I'm sure my login username, pass ans 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);
});
});
});
via DR.DRE
No comments:
Post a Comment