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

hubot-sensors

v1.1.1

Published

A hubot script to create and manage hubot sensors.

Downloads

6

Readme

hubot-sensors

A hubot script to create and manage hubot sensors.

Build Status

Setup

Create in your hubot location a directory to put there your sensors.

$ mkdir my_sensors

Then set the environment variable HUBOT_SENSORS_FOLDER to this folder created before.

$ export HUBOT_SENSORS_FOLDER="./mysensors"

Now, set the environment variable HUBOT_SENSORS_ROOM to use this chat room for your sensor's notifications.

$ export HUBOT_SENSORS_ROOM="sensors-warnings"

You'll need to add this as a dependency to your hubot:

$ npm install --save hubot-sensors

Lastly add it to the list of external dependencies in external-scripts.json:

["hubot-sensors"]

How to create your own sensors

Basically, you should create a file in your sensor's folder that should export your sensor class. This class has to extend the HubotSensor class implementing the check and fire methods.

The check method should return a boolean value, maybe based on some condition, to indicate that your sensor should be fired. Whereas, the fire method should do your own logic, for example sending a message to the room indicating that there is something wrong (using the sensor's notify method).

Finally, from your sensor's constructor you should invoke to the parent's constructor (super method) passing the frecuency time, in miliseconds, that your sensor will be checked, and an optional boolean parameter to indicate if the sensor should be activated when is loaded.

In the default_sensors folder your will find some examples that can help you to implement your own sensors.

Current commands

sensors list - List all sensors loaded
sensors list enabled - List all sensors enabled
sensors list disabled - List all sensors disabled
sensors enable <sensor_name> - Enable the sensor requested
sensors disable <sensor_name> - Enable the sensor requested

Example

hubot sensors list

Will output:

Current list of sensors:
CountDownSensor		A count down sensor fired each 10 minutes
WeatherSensor    	Info of WeatherSensor