Giter Club home page Giter Club logo

puppet-healthcheck's Introduction

puppet-healthcheck

Types

tcp_conn_validator

tcp_conn_validator is used to verify that a service is listening on a given port. It could be used to test either a remote or a local service. It support both IPv4 and IPv6 connection strings. It also works with hostname.

tcp_conn_validator { 'foo-machine ssh service' :
  host => '192.168.0.42',
  port   => 22,
}

The namevar of this resource can also be the connection string. It comes handy when one already have an array of ip:port or hostname:port string to test.

mongodb_cluster_nodes = ['192.168.0.2:27017', 'node02.foo.bar.com:27017']
tcp_conn_validator { $mongodb_cluster_nodes : }

host

IP address or server DNS name on which the service is supposed to be bound to. Required if the namevar is not a connection string.

port

Port on which the service is supposed to listen. Required if the namevar is not a connection string.

try_sleep

The time to sleep in seconds between ‘tries’. Default: 1

timeout

Number of seconds to wait before timing out. Default: 60

http_conn_validator

http_conn_validator is used to verify that an http server is answering on a given port. It could be used to test either a remote or a local service. It support both IPv4 and IPv6 connection strings. It also works with hostname.

It currently has the Accept header hardcoded to application/json, you can only connect to sites that return json

See

@test_headers = { 'Accept' => 'application/json' }
for details

http_conn_validator { 'foo-machine home' :
  host    => '127.0.0.1',
  port    => 80,
  use_ssl => true,
}

The namevar of this resource can also be the connection string. It comes handy when one already have an array of URLs string to test.

appli_cluster_nodes = ['https://server1.com/test-url', 'https://server2.com/test-url']
http_conn_validator { $appli_cluster_nodes : }

host

IP address or server DNS name on which the service is supposed to be bound to. Required if the namevar is not a connection string.

port

Port on which the service is supposed to listen. Required if the namevar is not a connection string.

use_ssl

Whether the connection will be attempted using https. Default: false

test_url

URL to use for testing if the HTTP server is up. Default: /

try_sleep

The time to sleep in seconds between ‘tries’. Default: 1

timeout

Number of seconds to wait before timing out. Default: 60

expected_code

Expected HTTP result code to consider success. Default: 200

verify_peer

Whether to verify the peer credentials, if possible. Verification will not take place if the CA certificate is missing

puppet-healthcheck's People

Contributors

alexjfisher avatar b4ldr avatar bastelfreak avatar bbriggs avatar deanwilson avatar dhoppe avatar duritong avatar ekohl avatar igalic avatar juniorsysadmin avatar jyaworski avatar kbucheli avatar kenyon avatar nibalizer avatar sacres avatar sandra-thieme avatar smortex avatar soylentgrn avatar spredzy avatar tragiccode avatar vinzent avatar wyardley avatar zilchms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-healthcheck's Issues

Arguments are not used on http_conn_validator

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.24.0
  • Ruby: ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5) [x86_64-linux]
  • Distribution: Ubuntu
  • Module version: 2.0.0

How to reproduce (e.g Puppet code you use)

http_conn_validator { 'influxdb-conn-validator_auth' :
    host      => 'localhost',
    port      => 8086,
    use_ssl   => false,
    test_url  => '/health',
    try_sleep => 5,
}

Output log

Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection; sleeping 5 seconds before retry
Notice: Unable to connect to the server (http://localhost:8086/health): undefined method `fetch' for nil:NilClass
Notice: Failed to make an HTTP connection within timeout window of 60 seconds; giving up.
Notice: /Stage[main]/Influxdb/Http_conn_validator[influxdb-conn-validator_auth]/ensure: current_value 'absent', should be 'present' (noop) (corrective)
Debug: /Stage[main]/Influxdb/Http_conn_validator[influxdb-conn-validator_auth]: The container Class[Influxdb] will propagate my refresh event

Any additional information you'd like to impart

Seems arguments are not to get passed on...
Works fine on 1.0.1

Tcp_conn_validator doesn't respect timeout if the connection is dropped

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.26.0
  • Ruby: 2.7.8p225
  • Distribution: Debian 10
  • Module version: 2.0.0

How to reproduce (e.g Puppet code you use)

time puppet apply --debug -e "tcp_conn_validator { '1.2.3.4:443': timeout => 10}"

What are you seeing

The Tcp_conn_validator resource takes 2 minutes to execute.

What behaviour did you expect instead

The Tcp_conn_validator should fail after 10 seconds.

Output log

[...]
Info: Applying configuration version '1709733218'
Notice: Failed to connect to the host within timeout window of 10 seconds; giving up.
Error: Unable to connect to the  host. (1.2.3.4:443)
Error: /Stage[main]/Main/Tcp_conn_validator[1.2.3.4:443]/ensure: change from 'absent' to 'present' failed: Unable to connect to the  host. (1.2.3.4:443)
Debug: Class[Main]: Resource is being skipped, unscheduling all events
Debug: Stage[main]: Resource is being skipped, unscheduling all events
Debug: Finishing transaction 12780
Debug: Storing state
Debug: Pruned old state cache entries in 0.00 seconds
Debug: Stored state in 0.01 seconds
Notice: Applied catalog in 120.12 seconds
[...]

Any additional information you'd like to impart

The 2 minutes timeout seems to be the http_connect_timeout of Puppet, which is used in https://github.com/voxpupuli/puppet-healthcheck/blob/master/lib/puppet_x/puppet-community/tcp_validator.rb#L31 . I think this timeout should at least be configurable. And it should be at most the timeout of the Tcp_conn_resource.

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.