monitorsPkg

package
v6.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

README

chifra monitors

chifra monitors has allows you to display information about the current set of monitors. This is not to be confused with the monitoring function available from the khedra tool. Please see that Khedra Book for more information.

Crud commands

chifra list creates a new monitor. See that tool's help file for more information.

The chifra monitors --delete command deletes (or --undelete if already deleted) an address but does not remove it from your hard drive. The monitor is marked as being deleted, making it invisible to other tools.

Use the --remove command to permanently remove a monitor from your computer. This is an irreversible operation and requires the monitor to have been previously deleted.

The --decache option will remove not only the monitor but all of the cached data associated with the monitor (for example, transactions or traces). This is an irreversible operation (except for the fact that the cache can be easily re-created with chifra list <address>). The monitor need not have been previously deleted.

Purpose:
  Add, remove, clean, and list address monitors.

Usage:
  chifra monitors [flags] <address> [address...]

Arguments:
  addrs - one or more addresses (0x...) to process

Flags:
      --delete       delete a monitor, but do not remove it
      --undelete     undelete a previously deleted monitor
      --remove       remove a previously deleted monitor
  -C, --clean        clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
  -l, --list         list monitors in the cache (--verbose for more detail)
  -U, --count        show the number of active monitors (included deleted but not removed monitors)
  -S, --staged       for --clean, --list, and --count options only, include staged monitors
  -D, --decache      removes related items from the cache
  -x, --fmt string   export format, one of [none|json*|txt|csv]
  -v, --verbose      enable verbose output
  -h, --help         display this help screen

Notes:
  - An address must be either an ENS name or start with '0x' and be forty-two characters long.
  - If no address is presented to the --clean command, all existing monitors will be cleaned.

Data models produced by this tool:

Other Options

All tools accept the following additional flags, although in some cases, they have no meaning.

  -v, --version         display the current version of the tool
      --output string   write the results to file 'fn' and return the filename
      --append          for --output command only append to instead of replace contents of file
      --file string     specify multiple sets of command line options in a file

Note: For the --file string option, you may place a series of valid command lines in a file using any valid flags. In some cases, this may significantly improve performance. A semi-colon at the start of any line makes it a comment.

Note: If you use --output --append option and at the same time the --file option, you may not switch export formats in the command file. For example, a command file with two different commands, one with --fmt csv and the other with --fmt json will produce both invalid CSV and invalid JSON.

Copyright (c) 2024, TrueBlocks, LLC. All rights reserved. Generated with goMaker.

Documentation

Overview

monitorsPkg implements the chifra monitors command.

chifra monitors has allows you to display information about the current set of monitors. This is not to be confused with the monitoring function available from the khedra tool. Please see that [Khedra Book for more information](https://khedra.trueblocks.io/).

### Crud commands

chifra list creates a new monitor. See that tool's help file for more information.

The chifra monitors --delete command deletes (or --undelete if already deleted) an address but does not remove it from your hard drive. The monitor is marked as being deleted, making it invisible to other tools.

Use the --remove command to permanently remove a monitor from your computer. This is an irreversible operation and requires the monitor to have been previously deleted.

The --decache option will remove not only the monitor but all of the cached data associated with the monitor (for example, transactions or traces). This is an irreversible operation (except for the fact that the cache can be easily re-created with chifra list <address>). The monitor need not have been previously deleted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMonitorMap

func GetMonitorMap(chain string) (map[base.Address]*monitor.Monitor, []*monitor.Monitor)

func ResetOptions

func ResetOptions(testMode bool)

func RunMonitors

func RunMonitors(cmd *cobra.Command, args []string) error

RunMonitors handles the monitors command for the command line. Returns error only as per cobra.

func ServeMonitors

func ServeMonitors(w http.ResponseWriter, r *http.Request) error

ServeMonitors handles the monitors command for the API. Returns an error.

Types

type MonitorsOptions

type MonitorsOptions struct {
	Addrs    []string              `json:"addrs,omitempty"`    // One or more addresses (0x...) to process
	Delete   bool                  `json:"delete,omitempty"`   // Delete a monitor, but do not remove it
	Undelete bool                  `json:"undelete,omitempty"` // Undelete a previously deleted monitor
	Remove   bool                  `json:"remove,omitempty"`   // Remove a previously deleted monitor
	Clean    bool                  `json:"clean,omitempty"`    // Clean (i.e. remove duplicate appearances) from monitors, optionally clear stage
	List     bool                  `json:"list,omitempty"`     // List monitors in the cache (--verbose for more detail)
	Count    bool                  `json:"count,omitempty"`    // Show the number of active monitors (included deleted but not removed monitors)
	Staged   bool                  `json:"staged,omitempty"`   // For --clean, --list, and --count options only, include staged monitors
	Globals  globals.GlobalOptions `json:"globals,omitempty"`  // The global options
	Conn     *rpc.Connection       `json:"conn,omitempty"`     // The connection to the RPC server
	BadFlag  error                 `json:"badFlag,omitempty"`  // An error flag if needed

}

MonitorsOptions provides all command options for the chifra monitors command.

func GetMonitorsOptions

func GetMonitorsOptions(args []string, g *globals.GlobalOptions) *MonitorsOptions

GetMonitorsOptions returns the options for this tool so other tools may use it.

func GetOptions

func GetOptions() *MonitorsOptions

func MonitorsFinishParseInternal

func MonitorsFinishParseInternal(w io.Writer, values url.Values) *MonitorsOptions

func (*MonitorsOptions) FreshenMonitorsForWatch

func (opts *MonitorsOptions) FreshenMonitorsForWatch(addrs []base.Address) (bool, error)

func (*MonitorsOptions) HandleClean

func (opts *MonitorsOptions) HandleClean(rCtx *output.RenderCtx) error

HandleClean handles the chifra monitors --clean command.

func (*MonitorsOptions) HandleCount

func (opts *MonitorsOptions) HandleCount(rCtx *output.RenderCtx) error

HandleCount handles the chifra abis --count command.

func (*MonitorsOptions) HandleCrud

func (opts *MonitorsOptions) HandleCrud(rCtx *output.RenderCtx) error

HandleCrud handles the chifra monitors delete, undelete, remove and decache commands.

[State] | Delete | Undelete | Remove | ------------|--------|-------------------| Not Deleted | Delete | Error | Error | Deleted | Error | Undelete | Remove | ------------|--------|-------------------|

func (*MonitorsOptions) HandleDecache

func (opts *MonitorsOptions) HandleDecache(rCtx *output.RenderCtx) error

func (*MonitorsOptions) HandleList

func (opts *MonitorsOptions) HandleList(rCtx *output.RenderCtx) error

HandleList handles the chifra monitors --list command.

func (*MonitorsOptions) HandleShow

func (opts *MonitorsOptions) HandleShow(rCtx *output.RenderCtx) error

func (*MonitorsOptions) MonitorsInternal

func (opts *MonitorsOptions) MonitorsInternal(rCtx *output.RenderCtx) error

MonitorsInternal handles the internal workings of the monitors command. Returns an error.

func (*MonitorsOptions) String

func (opts *MonitorsOptions) String() string

String implements the Stringer interface

type Scraper

type Scraper struct {
	Running   bool    `json:"Running"`
	SleepSecs float64 `json:"SleepSecs"`
	Name      string  `json:"Name"`
}

func NewScraper

func NewScraper(color, name string, secs float64, logLev uint64) Scraper

func (*Scraper) ChangeState

func (scraper *Scraper) ChangeState(onOff bool, tmpPath string) bool

func (*Scraper) Pause

func (scraper *Scraper) Pause()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL