🧑🏻‍⚕️ Command-line utility which poll on remote addresses in order to perform status checks periodically

Overview

ナース (Nāsu)

🧑🏻‍⚕️ Command-line utility which poll on remote addresses in order to perform status checks periodically

Crates.io Documentation Build Lint Tests

Motivation

Nāsu (from Japanese ナース [Nāsu], which means nurse), is a command-line utility to perform checks on remote addresses periodically.

Usage

Install nasu using cargo install command:

cargo install nasu

Create a nasu.json file and execute nasu.

Nasu will execute the tasks specified on nasu.json and will provide details in your terminal as follows:

Log Time        | Task            | HTTP. Status Code    | Req. Time       | Res. Time
==========================================================================================
1614824476370   | httpbin get     | 200                  | 1614824476081   | 1614824476369
1614824476438   | httpbin post    | 200                  | 1614824476081   | 1614824476438
1614824481220   | httpbin get     | 200                  | 1614824481084   | 1614824481220
1614824486226   | httpbin get     | 200                  | 1614824486085   | 1614824486226
1614824491221   | httpbin get     | 200                  | 1614824491085   | 1614824491221

Terminology

The following terminology is used to refer to nasu main components:

Service

Service to perform task against through the Worker, a service is created from a task defined in the nasu.json file.

Worker

Worker in responsible of performing the task, holds the logic to interact with the service in question.

Task

Defintion of steps to be performed by the worker. Is provided in the nasu.json file.

nasu.json Reference

nasu.json is the default configuration file for Nasu. This file is parsed at startup by Nasu to initialize Workers.

The nasu.json file is composed by an array of Task objects as shown below:

// nasu.json
[
  {
    "id": "HTTPBIN POST Request",
    "type": "http",
    "task": {
      "interval": "* */10 * * * *"
    },
    "params": {
      "url": "http://httpbin.org/post",
      "method": "POST",
      "headers": {
        "authorization": "Bearer <Token>",
        "content-type": "application/json"
      }
    }
  }
]

Each of these Task must contain the following properties:

Property Description Required Possible Values
id The id of the service. Used as reference for the user Yes N/A
type Type of service to perform check on Yes http
task Task configuration Yes N/A
task.interval Cron defintion to specify when to perform the test Yes N/A
params Params for the Worker used on perform. Refer to Worker Params Yes N/A

Task interval field

sec min hour day of month month day of week year

The interval field on a task uses a cron definition.

 ┌────────────── second (0 - 59)
 │ ┌───────────── minute (0 - 59)
 │ │ ┌───────────── hour (0 - 23)
 │ │ │ ┌───────────── day of the month (1, 15)
 │ │ │ │ ┌───────────── month (Mon, Wed, Fri)
 │ │ │ │ │ ┌───────────── day of the week (Mon,Wed,Fri)
 │ │ │ │ │ │ ┌──────────── year
 │ │ │ │ │ │ │
 │ │ │ │ │ │ │
 * * * * * * *

An example:

0 30 9,12,15 1,15 May-Aug Mon,Wed,Fri 2018/2

This application uses cron crate internally to parse and calculate time intervals.

Worker Params

Worker params may vary based on the type of worker in question. Properties defined below belong to an object specified in the Task object, inside of the params property.

HTTP Worker Params

  • Type: http
  • Property: params
Property Description Required Possible Values
url URL to perform the HTTP Request Yes N/A
method HTTP Method to perform the request with Yes GET, PATCH, POST, PUT, DELETE
headers HTTP Headers to provide to the request No N/A

Release

In order to create a release you must push a Git tag as follows

git tag -a <version> -m <message>

Example

git tag -a  v0.1.0 -m "First release"

Tags must follow SemVer conventions and must be prefixed with a lowercase v letter.

Then push tags as follows:

git push origin main --follow-tags
You might also like...
Remote-Archive is a utility for exploring remote archive files without downloading the entire contents of the archive.

[WIP] REMOTE-ARCHIVE Remote-Archive is a utility for exploring remote archive files without downloading the entire contents of the archive. The idea b

A server to continously poll nearly always-on sites to verify that your internet connectivity stays up

Dead Router A server to continously poll nearly always-on sites to verify that your internet connectivity stays up! If one or more of the servers stop

Provides utility functions to perform a graceful shutdown on an tokio-rs based service

tokio-graceful-shutdown IMPORTANT: This crate is in an early stage and not ready for production. This crate provides utility functions to perform a gr

Periodically download a youtube playlist, extract audio, convert to mp3, move to directory (possibly synced using syncthing).

auto-dl Periodically download a youtube playlist, extract audio, convert to mp3, move to directory (possibly synced using syncthing). drop https://git

Backup a folder to AWS S3, once or periodically

awsbck This utility lets you compress a folder and upload it to a AWS S3 bucket, once or periodically. Disclaimer This software is in a beta stage and

Checks your files for existence of Unicode BIDI characters which can be misused for supply chain attacks. See CVE-2021-42574

BIDI Character Detector This tool checks your files for existence of Unicode BIDI characters which can be misused for supply chain attacks to mitigate

A command-line utility which aligns a block of text within the terminal (or a specified number of columns), written in Rust.
A command-line utility which aligns a block of text within the terminal (or a specified number of columns), written in Rust.

align: a command line utility for aligning text. ⭐ Overview Aligns text within the terminal (or a specified number of columns). The text is treated as

Rust CLI utility library. Error handling, status reporting, and exit codes.
Rust CLI utility library. Error handling, status reporting, and exit codes.

narrate This library provides CLI application error and status reporting utilities. The coloured output formatting aims to be similar to Cargo. Error

Thin wrapper around starship.rs to format kakoune status line

kakship is just a thin wrapper around starship to format the status line of kakoune and is meant to be used with the included kakoune script kakship.kak.

A small utility for modifying ELF shared library loading order.

elfpromote A small utility for modifying ELF shared library loading order. Usage $ cargo install elfpromote $ ldd blueboat_server linux-vdso.s

A rust proc-macro which allows for reading and writing to remote objects through a generated enum

Remote-Obj A rust proc-macro which allows for reading and writing fields/variants of (possibly nested) remote objects by generating a single enum whic

Zopfli Compression Algorithm is a compression library programmed in C to perform very good, but slow, deflate or zlib compression.

Zopfli Compression Algorithm is a compression library programmed in C to perform very good, but slow, deflate or zlib compression.

CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" format.

Lighthouse Groupie CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" form

CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a plotable format.

Lighthouse Aggregator CLI tool that make it easier to perform multiple lighthouse runs towards a single target and output the result in a "plotable" f

Example of a SC coded in RUST that can safely perform any swaps of tokens (NFT, SFT, ESDT, MetaESDT)
Example of a SC coded in RUST that can safely perform any swaps of tokens (NFT, SFT, ESDT, MetaESDT)

Elrond-NFT-Trading Example of a Smart Contract (SC) coded in RUST, that can perform any swaps of tokens (NFT, SFT, ESDT, MetaESDT) The idea P2P swaps

Help your Flipper Zero perform tricks!

backflip: Help your Flipper Zero perform tricks! backflip is a CLI multi-tool to help augment and extend the capabilities of the Flipper Zero. It curr

Tool written in Rust to perform Password Spraying attacks against Azure/Office 365 accounts

AzurePasswordSprayer Tool written in Rust to perform Password Spraying attacks against Azure/Office 365 accounts. It is multi threaded and makes no co

Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

Vanitygen-bip39 - Generate vanity / gas efficient Ethereum addresses for your hdwallet (bip39 12 or 24 words)
Vanitygen-bip39 - Generate vanity / gas efficient Ethereum addresses for your hdwallet (bip39 12 or 24 words)

vanitygen-bip39 Generate Ethereum gas efficient addresses with leading zeros https://medium.com/coinmonks/on-efficient-ethereum-addresses-3fef0596e263

Comments
  • Feature | Implement HTTP Provider for HTTP Challenges

    Feature | Implement HTTP Provider for HTTP Challenges

    Implements the HTTP Provider to perform HTTP Challenges on nasu.

    Concepts

    I've began with some concepts definitions to improve our understanding on this project.

    Please provide questions or feedback as you find the need, these concepts are more of a content in RFC stage than something solid to stick with.

    Target

    Stands for the component of infrastructure to poll on. The target could be any component in a network which has an interface to communicate with nasu using a Provider based on the interface exposed by this Target.

    Challenge

    The act of performing a task on some Target using a Provider.

    Provider

    A Provider is an agent in charge of perform the challenge for an specific Target.

    Providers may change in relation the Target, if the Target is an HTTP Server you would perform your challenge with the HTTP Provider, but if instead, you are performing a challenge on a raw TCP stream, you would use the TCP Provider.

    C.C: @Armiixteryx

    opened by EstebanBorai 0
  • [Security] Workflow release.yml is using vulnerable action actions/checkout

    [Security] Workflow release.yml is using vulnerable action actions/checkout

    The workflow release.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability. The vulnerability fix that is missing by actions version could be related to: (1) CVE fix (2) upgrade of vulnerable dependency (3) fix to secret leak and others. Please consider to update the reference to the action.

    opened by igibek 0
  • Notifications | Implement support for Webhook notifications

    Notifications | Implement support for Webhook notifications

    Currently Nasu is not able to notify the behavior of any service.

    To provide notifications for services on certain behaviors, webhooks could be implemented. Webhooks could be configured on each service through the nasu.json configuration file.

    [
      {
        "id": "httpbin get",
        "type": "http",
        "task": {
          "interval": "*/5 * * * * *"
        },
        "params": {
          "url": "http://httpbin.org/get",
          "method": "GET",
          "headers": {
            "authorization": "Bearer abc",
            "content-type": "application/json"
          }
        },
        "webhook": {
          "url": "https://my-webhook-endpoint.com",
          "on_status_code": [500, 400],
          "send_response_body": true,
          "send_response_headers": true,
          "send_response_status_code": true
        }
      }
    ]
    

    I think this could be improved a lot, some suggestions would help shaping this up to have an structured feature for this use case.

    help wanted good first issue 
    opened by EstebanBorai 0
Releases(v0.1.0)
Owner
Esteban Borai
I'm a Software Engineer writing solutions with Rust and TypeScript
Esteban Borai
gstats — command line tool to print a developer handy summary of all git repositories below current directory

gstats Simple Rust tool to get quick summary info on git repos showing latest tag, branch, state. I implemented this to help me work with a the not to

Boon at Shift 12 Jun 10, 2021
Rust Code Completion utility

Racer - code completion for Rust RACER = Rust Auto-Complete-er. A utility intended to provide Rust code completion for editors and IDEs. Maybe one day

null 3.4k Jan 4, 2023
⚙️ Workshop Publishing Utility for Garry's Mod, written in Rust & Svelte and powered by Tauri

⚙️ gmpublisher Currently in Beta development. A powerful and feature-packed Workshop publisher for Garry's Mod is finally here! Click for downloads Ar

William 484 Jan 7, 2023
A simple utility for multithreading a/synchronization

Flowync Quick Example use flowync::Flower; fn main() { let flower = Flower::<i32, String>::new(1); std::thread::spawn({ let handle =

Adia Robbie 12 Dec 5, 2022
A small utility to compare Rust micro-benchmarks.

cargo benchcmp A small utility for comparing micro-benchmarks produced by cargo bench. The utility takes as input two sets of micro-benchmarks (one "o

Andrew Gallant 304 Dec 27, 2022
🤖 Just a command runner

just just is a handy way to save and run project-specific commands. (非官方中文文档,这里,快看过来!) Commands, called recipes, are stored in a file called justfile

Casey Rodarmor 8.2k Jan 8, 2023
Cargo command to create the README.md from your crate's documentation

Cargo rdme Cargo command to create your README from your crate’s documentation. Installation You can install cargo rdme with cargo by running cargo in

Diogo Sousa 42 Dec 24, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Generate IPv4 12th order Hilbert heatmaps from a file of IPv4 addresses.

Rustified IPv4 Heatmap This is a pure Rust version of the C ipv4-heatmap utility originally published by The Measurement Factory and updated forever-a

boB Rudis 8 Sep 28, 2022