GithubHelp home page GithubHelp logo

Comments (2)

jeanml avatar jeanml commented on June 9, 2024

Documenting a few options discussed on Slack:

  1. Not supporting PowerShell scripts at all, i.e. wrap up the execution in a Windows batch file that is natively supported by Sensu [This is currently the workaround I am using]
  2. Write some kind of twisted logic in the deployment agent to check whether a script is a PowerShell script and add powershell.exe -NonInteractive -NoProfile -ExecutionPolicy Bypass -file (or something along those lines) to the command when creating the check definition.
  3. Add an extra property, say script_type in healthchecks.yml, where values can be bash or powershell or windows-cmd and use that to figure out if the check definition's command requires the command prefix mentioned in 2)
  4. By convention, only support PowerShell scripts on Windows, and use the platform property set during deployments (https://github.com/trainline/consul-deployment-agent/blob/master/agent/deployment.py#L25) to figure out what to do. if linux, do nothing. if windows, add the command prefix mentioned above. If the script isn't a PowerShell script, checks are likely to fail and create enough noise that development teams will be able to fix their issue and comply with the convention.
  5. Stop messing about too much with Sensu check definitions in the deployment agent and let us specify the actual command in healthchecks.yml. This is at the expense of not checking if the script you are trying to run exists or not. Like in 4), should the script to execute not being there, it should create enough noise for development teams to fix.

from consul-deployment-agent.

jeanml avatar jeanml commented on June 9, 2024

My personal opinion is that we should go for options 4 or 5.

Option 4:

  • We are already enforcing the use of PowerShell scripts for lifecycle hook scripts (https://github.com/trainline/consul-deployment-agent/blob/master/agent/deployment_stages/common.py#L30-L33). if not, number 5).
  • Most will agree that PowerShell is a great (if not the best/only) default for scripting on Windows.
  • Allows development teams to not have to hard code location of Sensu plugins
  • Con: Separating out script from its arguments in healthchecks.yml is perhaps not the greatest and adds a bit of complexity in the deployment agent
  • Con: Some magic is happening in deployment agent to form a valid check command. What if the a check requires a different execution policy or different PowerShell options?

Option 5:

  • WYSIWYG: check command is entirely under development team's control
  • Con: Need to hardcode location of Sensu plugins, unless available as an environment variable for example.
  • Con: No check the check command script is found on disk

Also, I have a slight concern about supporting PowerShell only, as some of the Sensu Windows plugins are Ruby scripts (https://github.com/sensu-plugins/sensu-plugins-windows). That being said, there seem to be a PowerShell equivalent available as well. My other concern is using other Sensu plugins, e.g. https://github.com/sensu-plugins/sensu-plugins-aws, written in Ruby. However, it looks like all of them need to run on Linux machines so there might not be any need to support Ruby plugins on Windows, unless we port them to PowerShell if need be.

from consul-deployment-agent.

Related Issues (4)

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.