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

redis-lister

v1.1.3

Published

Command-line tool to monitor Redis keys in realtime

Downloads

4

Readme

redis-lister

Command-line tool to monitor Redis keys in realtime. Useful when you are using Redis as a queue job to monitor your keys, for example. Or for debugging.

Demo (full size):

The GIF demo of this app

Features

  • Specify hostname and update interval
  • Specify monitored keys and their types
  • Automatically reconnecting Redis if disconnecting
  • Handling errors correctly (e.g. when the wrong key type is specified)
  • Friendly user-interface (thanks to blessed and blessed-contrib!)

Installation and running

npm install -g redis-lister
redis-lister path/to/config.json

Configuration

The second argument to redis-lister should be an absolute or a relative path to JSON configuration file. Check out the example config.

The fields that are used:

  • host - A connection string to connect to Redis. Example: redis://localhost:6379/0
  • keys - List of monitored keys. An object.
  • commands List of custom commands (see below). Not necessary.
  • updateInterval - A number that specifies an interval (in millisecons - 1000 === 1s) of keys refreshing. Example: 100.

The keys object contains a list of monitored keys, where key name is a Redis key name, and the key value is a Redis command keyword (see the already defined keywords below). Each field of the keys object can be either a string or an array of strings. Using the array can be useful when you want to monitor the same object with 2 different commands (e.g. display a list and its content). The command names are case-insensitive (both zcount and ZCOUNT are the same), however the keys names are case-sensitive (the list and LIST are two different objects). Example:

"keys": {
  "key1": "zcount",
  "key2": "llen",
  "key3": ["hget", "hkeys"],
  "key4": "get"
  "key5": "scard",
},

This config will display 6 entries (the key3 entry will be displayed twice with hget and hkeys commands).

If the config is wrong, an error will be thrown.

How does it work?

This tool sends a batch query to a Redis server each updateInterval milliseconds. After that, it uses blessed and blessed-contrib to display the result. The prefedined commands keywords are :

  • get - GET name
  • hlen - HLEN name
  • llen - LLEN name
  • scard - SCARD name
  • zrange - ZRANGE name -inf +inf

If the key contains a value of the wrong type, the error message will be dislayed instead of the result. Note that the LIST name command returns null if the key is not set, while other commands return 0.

You can define your own commands by setting the commands field, where the key is the command keyword and the value is a command (%NAME% is replaced by key name). Example:

"commands": {
  "listitems": "lrange %name% 0 -1"
},
"keys": {
  "list": "listitems"
}

Dependencies

  • blessed and blessed-contrib - for the fancy UI
  • redis - for Redis connection and fetching data.
  • moment - for displaying timestamps
  • colors - for fancy colored log output
  • deep-assign - for loading user settings