google / cadvisor

Analyzes resource usage and performance characteristics of running containers.
Other
16.85k stars 2.31k forks source link

Support multi urls and basicauth for es #3567

Open hyphennn opened 1 month ago

hyphennn commented 1 month ago

Hi there.

Suppose that now I have a elastic cluster, which I do not want or I just can not enable sniffer, but still has several nodes to use. I configure the --storage_driver_es_host flag. Here comes the question: --storage_driver_es_host can conly accept one node, as the olivere/elastic.v2 supports multi nodes.

// cmd/internal/storage/elasticsearch/elasticsearch.go L131
        client, err := elastic.NewClient(
        elastic.SetHealthcheck(true),
        elastic.SetSniff(enableSniffer),
        elastic.SetHealthcheckInterval(30*time.Second),
        elastic.SetURL(elasticHost),
    )

I think it is not only helpful but also easy to change the 'elasticHost' variable into a multi nodes format, such as:

--storage_driver_es_host='1.1.1.1:5000,2.2.2.2:5000,3.3.3.3:5000'

Also, basic auth is not supported while I think it should be.

-storage_driver_es_username="xxx"
-storage_driver_es_password="xxx"

I do hope these can be supported in cAdvisor.

hyphennn commented 1 month ago

I've submitted a PR #3568 for this issue. I do hope it will work. Thanks a lot.

hyphennn commented 1 week ago

Hello? Is there anybody still maintaining this project? Or any new version/feature will be released?