ClusterLabs / fence-agents

Fence agents
104 stars 160 forks source link

fence_aws agent: monitor times out in large AWS accounts #395

Closed mpwhittaker closed 3 years ago

mpwhittaker commented 3 years ago

The monitor function in fence_aws.py queries all EC2 instances. If an account has a large number of instances, this will cause the monitor to exceed the default timeout value.

Feature request to allow filtering based on AWS instance tags.

Something similar to:

...
def get_nodes_list(conn, options):
        result = {}
        try:
          if "--filter" in options:
            filter_key   = options["--filter"].split("=")[0]
            filter_value = options["--filter"].split("=")[1]
            filter = [{ "Name": filter_key, "Values": [filter_value] }]
            for instance in conn.instances.filter(Filters=filter):
              result[instance.id] = ("", None)
          else:
            for instance in conn.instances.all():
              result[instance.id] = ("", None)
...
oalbrigt commented 3 years ago

Thanks. I've implemented it with minor improvements in https://github.com/ClusterLabs/fence-agents/pull/396.