Skip to content

zuazo/netstat-cookbook

Repository files navigation

Netstat Cookbook

GitHub License

Cookbook Version Dependency Status Build Status

Chef cookbook to install netstat network tool. Recommended for Docker containers.

Requirements

Supported Platforms

This cookbook has been tested on the following platforms:

  • Amazon Linux
  • CentOS
  • Debian
  • Fedora
  • openSUSE
  • Oracle Linux
  • RedHat
  • Scientific Linux
  • SUSE
  • Ubuntu

Please, let me know if you use it successfully on any other platform.

Required Applications

  • Chef 12 or higher.
  • Ruby 2.2 or higher.

Platform Support Related Attributes

Some cookbook attributes are used internally to support the different platforms. Surely you want to change them if you want to support new platforms or want to improve the support of some platforms already supported.

Attribute Default Description
node['netstat']['packages'] calculated Package list to install netstat.

Recipes

netstat::default

Installs netstat.

Usage Examples

Including in a Cookbook Recipe

You can simply include it in a recipe:

include_recipe 'netstat'

Don't forget to include the netstat cookbook as a dependency in the metadata.

# metadata.rb
# [...]

depends 'netstat'

Including in the Run List

Another alternative is to include the default recipe in your Run List:

{
  "name": "www.example.com",
  "[...]": "[...]",
  "run_list": [
    "recipe[netstat]"
  ]
}

Deploy with Docker

You can use the Dockerfile included in the cookbook source code to run the cookbook inside a container:

$ docker build -t chef-netstat .
$ docker run -ti chef-netstat netstat -nptua

The sample Dockerfile:

FROM zuazo/chef-local:debian-7

COPY . /tmp/netstat
RUN berks vendor -b /tmp/netstat/Berksfile $COOKBOOK_PATH
RUN chef-client -r "recipe[apt],recipe[netstat]"

CMD ["netstat", "-nptua"]

See the chef-local container documentation for more examples.

Testing

See TESTING.md.

Contributing

Please do not hesitate to open an issue with any questions or problems.

See CONTRIBUTING.md.

TODO

See TODO.md.

License and Author

Author: Xabier de Zuazo (xabier@zuazo.org)
Copyright: Copyright (c) 2015, Xabier de Zuazo
License: Apache License, Version 2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.