diff --git a/config.yml.example b/config.yml.example index 415ee36..1fbb216 100644 --- a/config.yml.example +++ b/config.yml.example @@ -228,6 +228,16 @@ reports: # default: _CHAT_ID_ # noc: _CHAT_ID_ +# - file: reportPullAPI +# channels: +# - hijack +# - newprefix +# - visibility +# - path +# - misconfiguration +# - rpki +# params: +# maxAlertsAmount: 10 ############################ # Notification settings: @@ -241,8 +251,16 @@ reports: notificationIntervalSeconds: 86400 persistStatus: true + +############################ +# REST API settings: +# - rest.host +# The IP address the server will listen. By default is localhost +# - rest.port +# The port the server will listen + rest: - host: null + host: localhost port: 8011 logging: @@ -264,8 +282,6 @@ generatePrefixListEveryDays: 0 # - file: uptimeApi # params: # useStatusCodes: true -# host: null -# port: 8011 # # - file: uptimeHealthcheck # params: diff --git a/src/config/config.js b/src/config/config.js index 95114be..ad24452 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -112,7 +112,7 @@ export default class Config { refreshVrpListMinutes: 15 }, rest: { - host: null, + host: "localhost", port: 8011 }, checkForUpdatesAtBoot: true, diff --git a/src/reports/reportPullAPI.js b/src/reports/reportPullAPI.js index d468869..b8ff33b 100644 --- a/src/reports/reportPullAPI.js +++ b/src/reports/reportPullAPI.js @@ -33,7 +33,6 @@ import Report from "./report"; import RestApi from "../utils/restApi"; import md5 from "md5"; -import moment from "moment"; export default class ReportPullAPI extends Report { @@ -42,8 +41,8 @@ export default class ReportPullAPI extends Report { this.name = "reportPullAPI" || this.params.name; this.enabled = true; - this.maxAlertsAmount = 100; - this.lastCheck = null; + this.maxAlertsAmount = this.params.maxAlertsAmount || 100; + this.lastQuery = null; let restDefault = env.config.rest || { port: params.port, host: params.host }; const rest = new RestApi(restDefault); @@ -79,12 +78,12 @@ export default class ReportPullAPI extends Report { res.contentType = 'json'; res.send({ meta: { - lastCheck: this.lastCheck + lastQuery: this.lastQuery }, data: this._getAlerts(req.params) }); next(); - this.lastCheck = moment(new Date()).utc(); + this.lastQuery = new Date().getTime(); }; _getAlerts = ({ hash, group }) => {