New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@toolisticon/ssl-hostinfo-prometheus-exporter

Package Overview
Dependencies
Maintainers
2
Versions
554
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toolisticon/ssl-hostinfo-prometheus-exporter - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0-greenkeeper-jasmine-3.4.0-1

3

app.js
const CronJob = require('cron').CronJob;
const pkg = require('./package.json');
const log = require('./lib/logger');

@@ -7,2 +8,4 @@ const config = require('./lib/config');

log.info('ssl-hostinfo-prometheus-exporter info', { version: pkg.version });
async function triggerUpdate () {

@@ -9,0 +12,0 @@ log.info('Start reading route information.');

@@ -0,1 +1,11 @@

# [1.1.0](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/compare/v1.0.2...v1.1.0) (2019-04-02)
### Features
* **End2End-Testing:** Using promtool for syntax checking ([5870924](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/commit/5870924))
* **Logging:** Use logging framework which is ELK-compatible ([a1d51a0](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/commit/a1d51a0))
## [1.0.2](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/compare/v1.0.1...v1.0.2) (2019-03-04)

@@ -2,0 +12,0 @@

1

lib/config.js

@@ -12,3 +12,2 @@ let config = {};

cron: process.env.CRON || '0 0 * * * *',
logLevel: process.env.LOG_LEVEL || 'ERROR',
urlsToCheck: urls

@@ -15,0 +14,0 @@ };

@@ -1,11 +0,20 @@

const config = require('./config');
const Logger = require('log4bro');
function logInfo (message) {
if (config.logLevel === 'INFO') {
console.log(`${new Date().toISOString()} INFO ${message}`);
}
const options = {
productionMode: process.env.LOG_LEVEL !== 'INFO', // switches loglevel between DEBUG and WARN
logDir: 'logs', // relative directory to write log file to
silence: false, // silences logger
loggerName: 'dev', // ignore
dockerMode: process.env.CONSOLE_LOG || false, // disables output to logfile
varKey: 'LOG' // name of global variable
};
const LOG = new Logger(options);
function logInfo (message, additionalFields = {}) {
LOG.info(message, additionalFields);
}
function logError (message) {
console.error(`${new Date().toISOString()} ERROR ${message}`);
function logError (message, additionalFields = {}) {
LOG.error(message, additionalFields);
}

@@ -12,0 +21,0 @@

@@ -29,6 +29,7 @@ const moment = require('moment');

const date = moment(value);
const labelKey = key.toLowerCase().split('-').join('_').split('.').join('_');
if (date.isValid()) {
return `${key.toLowerCase()}="${date.valueOf()}",`;
return `${labelKey}="${date.valueOf()}",`;
} else {
return `${key.toLowerCase()}="${value}",`;
return `${labelKey}="${value}",`;
}

@@ -190,5 +191,12 @@ }

let response = '';
response += `# HELP ${mozillaMetricName} Mozilla Observatory SSL stats\n`;
Object.keys(resultStore).map((host) => {
response += `${normalizePrometheusDate(resultStore[host].moz)}`;
});
response += `# HELP ${sslDetailsMetricName} Generic SSL Details\n`;
Object.keys(resultStore).map((host) => {
response += `${normalizePrometheusDate(resultStore[host].details)}`;
});
response += `# HELP ${sslExpireMetricName} Remaining Days before certificate expiry\n`;
Object.keys(resultStore).map((host) => {
response += `${normalizePrometheusDate(resultStore[host].expire)}`;

@@ -195,0 +203,0 @@ });

{
"name": "@toolisticon/ssl-hostinfo-prometheus-exporter",
"version": "1.0.2",
"version": "1.1.0-greenkeeper-jasmine-3.4.0-1",
"description": "",

@@ -21,3 +21,3 @@ "main": "index.js",

"preend2end-test": "docker build -t toolisticon/ssl-hostinfo-prometheus-exporter . && cd test/setup && docker-compose up -d --force-recreate && sleep 60",
"end2end-test": "pytest test/end2end/test_*.py --junitxml=target/reports/junit.xml",
"end2end-test": "pytest test/end2end/test_*.py --junitxml=target/reports/junit.xml && curl -s localhost:9000 | docker exec -i prometheus promtool check metrics",
"postend2end-test": "cd test/setup && docker-compose stop && docker-compose rm -f -s -v && docker volume prune -f",

@@ -60,2 +60,3 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",

"cron": "^1.6.0",
"log4bro": "^3.8.0",
"moment": "^2.24.0",

@@ -77,5 +78,5 @@ "request": "^2.88.0",

"eslint-plugin-standard": "^4.0.0",
"jasmine": "^3.3.1",
"jasmine": "^3.4.0",
"nodemon": "^1.18.10"
}
}

@@ -45,5 +45,43 @@ # Monitor SSL certificates in Prometheus

CRON: // set cron pattern, default is '0 0 * * * *',
LOG_LEVEL: // set log level, default is 'ERROR' ('INFO' outputs details info)
LOG_LEVEL: // set log level, default is 'ERROR' ('INFO' outputs details info),
CONSOLE_LOG: // set to true to omit logging to file, otherwise logs will be written to `logs` dir
```
Sample:
```
URLS_TO_CHECK=url1.sample.com,url2.sample.com LOG_LEVEL=INFO CONSOLE_LOG=true node app.js
```
Will produce the following output:
```
{"pid":65072,"msg":"[log4bro] Logger is: in-prod=false, in-docker:true, level=DEBUG, skipDebug=false","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.443Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Start reading route information.","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.563Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Triggering scan for url1.sample.com,url2.sample.com","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.563Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Triggering scan for url1.sample.com","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.563Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Triggering scan for url2.sample.com","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.566Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"prometheus-exporter listening at 9000","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.569Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Reading scan results for url1.sample.com","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.769Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Reading scan results for url2.sample.com","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:20.770Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Skipping invalid response for mozilla scoring","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:21.206Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
{"pid":65072,"msg":"Skipping invalid response for mozilla scoring","loglevel":"INFO","loglevel_value":30,"@timestamp":"2019-04-02T13:56:21.208Z","host":"MPB-M1.local","log_type":"application","application_type":"service"}
```
And
```
URLS_TO_CHECK=url1.sample.com,url2.sample.com LOG_LEVEL=INFO node app.js
```
creates this output:
```
INFO @ 2019-04-02T13:57:42.181Z : [log4bro] Logger is: in-prod=false, in-docker:false, level=DEBUG, skipDebug=false
INFO @ 2019-04-02T13:57:42.301Z : Start reading route information.
INFO @ 2019-04-02T13:57:42.301Z : Triggering scan for url1.sample.com,url2.sample.com
INFO @ 2019-04-02T13:57:42.301Z : Triggering scan for url1.sample.com
INFO @ 2019-04-02T13:57:42.304Z : Triggering scan for url2.sample.com
INFO @ 2019-04-02T13:57:42.307Z : prometheus-exporter listening at 9000
INFO @ 2019-04-02T13:57:42.507Z : Reading scan results for url1.sample.com
INFO @ 2019-04-02T13:57:42.508Z : Reading scan results for url2.sample.com
INFO @ 2019-04-02T13:57:43.001Z : Skipping invalid response for mozilla scoring
INFO @ 2019-04-02T13:57:43.024Z : Skipping invalid response for mozilla scoring
```
and the logs in JSON format within the directy `logs`
## Troubleshooting

@@ -50,0 +88,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc