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 0.2.1 to 0.3.0-develop-10

10

CHANGELOG.md

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

<a name="0.3.0"></a>
# [0.3.0](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/compare/v0.2.1...v0.3.0) (2019-01-26)
### Features
* **API:** Expose more pulic methods ([0a8183a](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/commit/0a8183a))
<a name="0.2.1"></a>

@@ -2,0 +12,0 @@ ## [0.2.1](https://github.com/toolisticon/ssl-hostinfo-prometheus-exporter/compare/v0.2.0...v0.2.1) (2019-01-26)

4

index.js

@@ -76,3 +76,3 @@ const http = require('http');

// reset data on route update
prometheus.reset();
prometheus.updateHosts(hostnames);
hostnames.forEach((hostname) => {

@@ -101,6 +101,8 @@ triggerScan(hostname);

module.exports = exports = {
config: config,
updateRouteInfo: updateRouteInfo,
updateRoutesInfo: updateRoutesInfo,
resetRouteInfo: prometheus.reset,
startPrometheusListener: startPrometheusListener,
logger: log
};

@@ -103,3 +103,9 @@ const moment = require('moment');

const data = Object.assign({}, dataAsJson, additionalMetadata);
resultStore[`moz-${dataAsJson.url}`] = json2prom(mozillaMetricName, data);
if (resultStore[dataAsJson.url]) {
resultStore[dataAsJson.url].moz = json2prom(mozillaMetricName, data);
} else {
resultStore[dataAsJson.url] = {
moz: json2prom(mozillaMetricName, data)
};
}
}

@@ -120,3 +126,9 @@ /**

const data = Object.assign({}, dataAsJson, additionalMetadata);
resultStore[`details-${dataAsJson.url}`] = json2prom(sslDetailsMetricName, data);
if (resultStore[dataAsJson.url]) {
resultStore[dataAsJson.url].details = json2prom(sslDetailsMetricName, data);
} else {
resultStore[dataAsJson.url] = {
details: json2prom(sslDetailsMetricName, data)
};
}
}

@@ -137,9 +149,35 @@ /**

const data = Object.assign({}, dataAsJson, additionalMetadata);
resultStore[`expire-${dataAsJson.url}`] = json2prom(sslExpireMetricName, data);
if (resultStore[dataAsJson.url]) {
resultStore[dataAsJson.url].expire = json2prom(sslExpireMetricName, data);
} else {
resultStore[dataAsJson.url] = {
expire: json2prom(sslExpireMetricName, data)
};
}
}
/**
*
*/
function updateHosts (updatedHosts) {
// loop and update results with hosts
Object.keys(resultStore).map((host) => {
let found = false;
updatedHosts.forEach((knownHost) => {
if (host === knownHost) {
found = true;
}
});
if (!found) {
delete resultStore[host];
}
});
}
function renderMetrics () {
let response = '';
Object.keys(resultStore).map((key) => {
response += `${resultStore[key]}\n`;
Object.keys(resultStore).map((host) => {
response += `${resultStore[host].moz}\n`;
response += `${resultStore[host].details}\n`;
response += `${resultStore[host].expire}\n`;
});

@@ -154,2 +192,3 @@ return response;

reset: init,
updateHosts: updateHosts,
addDetailsMetric: addDetailsMetric,

@@ -156,0 +195,0 @@ addExpireMetric: addExpireMetric,

{
"name": "@toolisticon/ssl-hostinfo-prometheus-exporter",
"version": "0.2.1",
"version": "0.3.0-develop-10",
"description": "",

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

"watch": "nodemon node index.js",
"lint": "eslint .",
"lint": "eslint --fix .",
"pretest": "npm run lint",

@@ -59,3 +59,3 @@ "test": "jasmine JASMINE_CONFIG_PATH=jasmine.json",

"devDependencies": {
"conventional-changelog-cli": "2.0.0",
"conventional-changelog-cli": "2.0.11",
"eslint": "^5.12.0",

@@ -62,0 +62,0 @@ "eslint-config-semistandard": "^13.0.0",

@@ -6,6 +6,6 @@ # Monitor SSL certificates in Prometheus

[![Build Status](https://jenkins.holisticon.de/buildStatus/icon?job=toolisticon/ssl-hostinfo-prometheus-exporter/master)](https://jenkins.holisticon.de/blue/organizations/jenkins/toolisticon%2Fssl-hostinfo-prometheus-exporter/branches/)
[![Docker Build Status](https://img.shields.io/docker/build/toolisticon/ssl-hostinfo-prometheus-exporter.svg)](https://hub.docker.com/r/toolisticon/ssl-hostinfo-prometheus-exporter/)
[![Docker Build Status](https://img.shields.io/docker/automated/toolisticon/ssl-hostinfo-prometheus-exporter.svg)](https://hub.docker.com/r/toolisticon/ssl-hostinfo-prometheus-exporter/)
[![npm version](https://badge.fury.io/js/%40toolisticon%2Fssl-hostinfo-prometheus-exporter.svg)](https://badge.fury.io/js/%40toolisticon%2Fssl-hostinfo-prometheus-exporter)
[![Docker Stars](https://img.shields.io/docker/stars/toolisticon/ssl-hostinfo-prometheus-exporter.svg)](https://hub.docker.com/r/toolisticon/ssl-hostinfo-prometheus-exporter/)
[![Docker Pulls](https://img.shields.io/docker/pulls/toolisticon/ssl-hostinfo-prometheus-exporter.svg)](https://hub.docker.com/r/toolisticon/ssl-hostinfo-prometheus-exporter/)
[![Greenkeeper badge](https://badges.greenkeeper.io/toolisticon/ssl-hostinfo-prometheus-exporter.svg)](https://greenkeeper.io/)

@@ -12,0 +12,0 @@ > Still **WIP**

@@ -29,2 +29,19 @@ const prometheus = require('../lib/prometheus');

it('should remove not used used', () => {
prometheus.addMozillaMetric({ url: 'host1', quantile: 1 });
prometheus.addMozillaMetric({ url: 'host2', quantile: 2 });
prometheus.addMozillaMetric({ url: 'host3', quantile: 3 });
prometheus.addExpireMetric({ url: 'host1', quantile: 1 });
prometheus.addExpireMetric({ url: 'host2', quantile: 2 });
prometheus.addExpireMetric({ url: 'host3', quantile: 3 });
prometheus.addDetailsMetric({ url: 'host1', quantile: 1 });
prometheus.addDetailsMetric({ url: 'host2', quantile: 2 });
prometheus.addDetailsMetric({ url: 'host3', quantile: 3 });
prometheus.updateHosts(['host1', 'host3']);
const result = prometheus.renderMetrics();
expect(result.indexOf('security_ssl_mozilla_observatory{url="host2",quantile="2",} 2.0') < 0).toBeTruthy();
expect(result.indexOf('security_ssl_expire_days_remaining{url="host2",quantile="2",} 2.0') < 0).toBeTruthy();
expect(result.indexOf('security_ssl_details{url="host2",quantile="2",} 2.0') < 0).toBeTruthy();
});
describe('mozilla http observatory', () => {

@@ -31,0 +48,0 @@ it('should add unknown score if invalid request', () => {

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