Skip to content

Shutdown if iptables-save fails #1

@perlun

Description

@perlun

Hi,

Thanks for an interesting exporter. We are currently investigating using it for one of our deployments.

When developing the Ansible role for deploying it to a server, I discovered that the error handling works in a slightly unusual way: if the capabilities for the process described in https://github.com/retailnext/iptables_exporter#required-permissions are not available, each request to /metrics will result in an exit status 1 error being logged to the syslog. The process will remain running.

I think this is not perhaps an ideal error handling strategy. It would be better if iptables-save would be called right on start, and if it fails, abort the process (exit with a non-zero return code). That way, the semantics are much more clearer to the user that "something is not working as it should".

Your thoughts on this, @eriksw?

Nov  6 13:43:00 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:43:00Z" level=info msg="Starting iptables_exporter (version=0.1.0, branch=master, revision=9172cd2acb4afc4ba77d48c85a46fbef36d5cb80)" source="iptables_exporter.go:153"
Nov  6 13:43:00 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:43:00Z" level=info msg="Build context (go=go1.10.3, user=root@f2efa59b1ef9, date=20180628-04:29:29)" source="iptables_exporter.go:154"
Nov  6 13:43:00 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:43:00Z" level=info msg="Listening on 0.0.0.0:9455" source="iptables_exporter.go:170"
Nov  6 13:43:46 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:43:46Z" level=error msg="exit status 1" source="iptables_exporter.go:95"
Nov  6 13:44:23 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:44:23Z" level=error msg="exit status 1" source="iptables_exporter.go:95"
Nov  6 13:44:24 scalability-test-centre iptables_exporter[71596]: time="2019-11-06T13:44:24Z" level=error msg="exit status 1" source="iptables_exporter.go:95"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions