npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

netgraph

v2.0.4

Published

graph csv data of network health

Downloads

2

Readme

netgraph

Netgraph generates pretty yeri graphs out of data from RRD files generated by collectd. The graphs are generated entirely client-side, fetching data over XHR.

Make whatever kind of cool monitoring page you want, using normal HTML/CSS, and netgraph will fill in the .netgraph divs with graphs from the RRDs you specify. No fuss.

Check out this demo of a snapshot of home-network latency graphs.

Requirements

  • ES6 support in your browser (as of 2017, all major browsers support it)
  • RRD files exposed through your website (usually by symlinking them into your web folder)
    • For example: ln -s /var/lib/collectd/rrd/MY_HOSTNAME /var/html/netgraph/collectd

How to build it

npm install

The finished products are placed in dist/:

  • netgraph.js is the actual product, created by webpack
  • demo.html is just a little demo to show you how it works

How it works

rrd tags in the page tell netgraph which files to load, and what data to pull out of those files:

  • name: give a unique name to this timeseries (used to graph it in netgraph-group)
  • path: (on the server) where the RRD file can be found
  • data: colon-separated name of the data series and which consolidation to use (like "value:AVERAGE")
  • timeout: (optional) XHR fetch timeout, in milliseconds (default: 2000)

The RRD files are fetched over XHR and parsed in javascript to extract the requested timeseries data.

In the page, any element with class netgraph will be filled with a graph of the timeseries data. These attributes configure each graph:

  • line: comma-separated list of RRD timeseries names (from the rrd tags) to plot
  • timespan: time this graph should cover ("hour", "day", or "week"; default: "hour")
  • unit: unit to use on the Y-axis label (default: "ms")
  • time: the end-point of this graph, in ISO format ("2021-03-31T12:00:00Z") if you want a different end-point than "now"
  • max: if set, scale the Y-axis to this maximum value
  • fill: if present, draw line graphs as filled
  • colors: comma-separated list of colors to use for the lines (default: yeri defaults)
  • no-highlight: turn off the highlight marker and tooltip that appear when you mouse over the graph (showing specific values on the graph)
  • no-tooltip: turn off just the floating tooltip

if several graphs will have the same values for some of these attributes, they may be set on an enclosing netgraph-group element. any netgraph element inside it will inherit any un-set values from the group.

Error graphs

Normal line series are plotted as a line. If a series represents an error (like dropped pings), you may want to graph it as a vertical red zone. For any series listed in the error attribute, any values greater than error-threshold are marked as red zones on the graph. Other values are ignored.

Error graph configuration attributes go in the same netgraph element. They are:

  • error: comma-separated list of RRD timeseries to treat as errors
  • error-threshold: value above which to draw error regions (default: 0.0)
  • error-color: color to use for the error zones (default: #f33)
  • error-opacity: CSS opacity of the error zones (default: 0.3)

Tooltip CSS

The floating tooltip is styled by CSS at the top of netgraph.ts. This CSS is prepended to the document. Any CSS you add to your page will override these defaults.

License

Apache 2 (open-source) license, included in 'LICENSE.txt'.

Authors

@robey - Robey Pointer [email protected]