Skip to content

Heimdall is a quick and easy way to manage and monitor short lived console applications on linux, macOS, and Windows.

License

Notifications You must be signed in to change notification settings

DnOberon/heimdall

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heimdall

GoDoc

Heimdall allows you to manage and monitor command line applications. Provided with an executable or command to run heimdall can perform the following operations:

  • Repeat the command n times
  • Run command in parallel in n instances
  • Filter and log command's output
  • Kill hung applications through user specified timeout

Install

go get github.com/dnoberon/heimdall 

If you want to run heimdall outside $GOPATH/bin make sure that $GOPATH/bin is included in your $PATH. If not, you can download heimdall’s releases for your platform here.

How to use heimdall

The easiest way to get started with heimdall after installation is to ask for its help menu.

> heimdall -h

Heimdall gives you a quick way to monitor, repeat, and selectively
log a CLI application. Quick configuration options allow
you to effectively test and monitor a CLI application in
development

Usage:
  heimdall [flags]
  
Available Commands:
  help        Help about any command
  init        Create a configuration for heimdall to replace command flag arguments
  run         Run heimdall using the "heimdall_config.json" file in the current directory 

Flags:
  -h, --help                help for heimdall
  -l, --log                 Toggle logging of provided program's stdout and stderr output to file, appends if file exists
      --logFilter string    Allows for log filtering via regex string. Use only valid with log flag
      --logName string      Specify the log file name, defaults to heimdall.log (default "heimdall.log")
      --logOverwrite        Toggle logging of provided program's stdout and stderr output to file
  -p, --parallelCount int   Designate how many instances of your should run in parallel at one time 
  -r, --repeat int          Designate how many times to repeat your program with supplied arguments (default 1)
  -t, --timeout duration    Designate when to kill your provided program
  -v, --verbose             Toggle display of provided program's stdout and stderr output while heimdall runs

Let’s run through a quick example based on the problem that started sthis whole thing - a console application managing a third-party, hidden application.

I want heimdall to filter the logs that both my application and the hidden one outputs as well (here we filter for < and > characters as long as there is at least 1 preceding character) as killing my application if it hangs.

Telling heimdall to do that is easy -

heimdall --timeout=30m --log --logFilter=<[^<>]+> exportApplication


Running heimdall with a configuration file

This tool provides the option of generating a json configuration file for ease of use. All command line flag arguments are available and represented inside the configuration file.

First, generate your configuration file using the heimdall init command and following the interactive prompts.

> heimdall init
Executable path: tester
✔ Program arguments separated by comma: █

Once your configuration file is generated you can run heimdall with a single command -

heimdall run

Your configuration file, heimdall_config.json is available in the directory you first ran heimdall init in. To make changes you can edit this file directly or rerun heimdall init


Can't you do this with a bash or powershell script?

You sure could - but you'd have to spend the time to build it, have separate scripts for at least windows and linux systems, or if you're using someone else's script, modify it to the point that it's going to work for your particular situation. You'll also have to handle multi-threading and logging yourself.

heimdall is meant to be extremely easy to use across platforms and applications by design. You shouldn't have to write some complicated scripts to achieve what heimdall can do with a single command.


More information

I've written an article about the "why" of heimdall as well as stepping through source code from the earliest version.

About

Heimdall is a quick and easy way to manage and monitor short lived console applications on linux, macOS, and Windows.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published