GithubHelp home page GithubHelp logo

isabella232 / boltwash Goto Github PK

View Code? Open in Web Editor NEW

This project forked from puppetlabs-toy-chest/boltwash

0.0 0.0 0.0 55 KB

Navigate your Bolt inventory in Wash

License: Apache License 2.0

Ruby 91.07% Shell 1.08% Dockerfile 7.85%

boltwash's Introduction

boltwash

A Wash plugin for Bolt. This plugin presents a view of Bolt targets organized by groups, and allows you to navigate their filesystems

wash . > stree bolt
bolt
└── [group]
    └── [target]
        └── fs

As an example, suppose you have a cluster of machines that are having problems

wash bolt/webservers > ls
server1/
server2/
server3/

You've noticed an issue in one of their logs, and want to see if it's present everywhere

wash bolt/webservers > grep OutOfMemory */fs/var/log/syslog
server1/fs/var/log/syslog:Jan 28 12:09:34 server1 my-server[435]: ...java.lang.OutOfMemoryError...
server2/fs/var/log/syslog:Jan 28 12:09:43 server2 my-server[435]: ...java.lang.OutOfMemoryError...
server3/fs/var/log/syslog:Jan 28 12:09:01 server3 my-server[435]: ...java.lang.OutOfMemoryError...

Seeing that they're all experiencing these issues, let's see where the server process is still running

wash bolt/webservers > wps * | grep bin/java
server1     9027   12:10.02   /usr/bin/java -Xmx2048m -cp /opt/my-server/server.jar ...
server2    21204   12:13.02   /usr/bin/java -Xmx2048m -cp /opt/my-server/server.jar ...

Looks like they've restarted recently, and the server's not running on server3. Let's reconfigure the servers to allow more memory (using Bolt or by directly modifying config/service files) and restart them

wash bolt/webservers > bolt task run service -t webservers action=restart name=my-server
Started on server1...
Started on server2...
Started on server3...
Finished on server1:
  {
    "status": "MainPID=751,LoadState=loaded,ActiveState=active"
  }
Finished on server2:
  {
    "status": "MainPID=2927,LoadState=loaded,ActiveState=active"
  }
Finished on server3:
  {
    "status": "MainPID=21936,LoadState=loaded,ActiveState=active"
  }
Successful on 3 targets: server1,server2,server3
Ran on 3 targets in 1.91 sec

The Bolt plugin for Wash provides an accessible, interactive means of investigating multiple systems. Combined with Bolt inventory, it's natural to then take action with Bolt.

Currently supports Bolt v1 and v2 inventories, but not inventory plugins.

Installation and configuration

  1. Install Wash

  2. gem install boltwash

  3. Get the path to the bolt.rb file with gem contents boltwash

    If you have multiple versions of boltwash installed, then you may need to do gem contents boltwash --version <version> to get the path. You can use gem list boltwash to see all installed versions of boltwash.

  4. Add to ~/.puppetlabs/wash/wash.yaml

    external-plugins:
        - script: '/path/to/boltwash/bolt.rb'
    # Uncomment this to get the inventory from a Boltdir instead
    # of the default ~/.puppetlabs/bolt
    #bolt:
    #  dir: /path/to/boltdir
  5. Start Wash with wash (or restart it if it's already running)

  6. Enjoy!

If you're a developer, you can use the bolt plugin from source with bundle install and set script: /path/to/boltwash/bolt.

Quirks

When sending complex commands over WinRM, you can pass the command as a single string with appropriate escaping, as in

wash bolt/win > wexec target 'Get-Process | Where StartTime -gt $([DateTime]::Today)'

Future improvements

  • Bolt inventory plugins
  • Implement the 'metadata' method to retrieve facts

boltwash's People

Contributors

ekinanp avatar mikaelsmith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.