Need help on monitoring N number of websites

35 views
Skip to first unread message

surendra matta

unread,
Jun 23, 2022, 11:47:28 AM6/23/22
to Prometheus Users
Hi Everyone,

I am new to Prometheus and we doing POC in our organization using Prometheus + Blackbox + AlertManager.

Our scenarios :

We need to monitor more than a 50 websites 24/7  in Prod and QA, sometime w will add the new websites too.

As of now , i have all my website names in a text file and my question is how define this text file in Prometheus targets , please let us me whether it is possible or not  ? or if we have any other alternative method to test the bulk URL's using black box . 

Thanks in advance.

Regards,
Venkat



 

Ben Kochie

unread,
Jun 23, 2022, 11:49:45 AM6/23/22
to surendra matta, Prometheus Users
Prometheus has a "file discovery" that can accept a list of targets as JSON or YAML.


--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/e5237457-86ff-46c5-94a5-9f1b3d302ce4n%40googlegroups.com.

surendra matta

unread,
Jun 23, 2022, 4:20:57 PM6/23/22
to Prometheus Users
if possible can you provide me with an example for the files_sd? 

I am trying the below steps

in Blackbox, I configured the below JSON

[{
    "labels": {
        "job": "blackbox"
    },
    "targets": [
        "http://prometheus.io",
        "https://prometheus.io"
    ]
}]

and I tried to run  ./ black_exporter --config.file=websites.json but it's not working  and I am getting the below error 

ts=2022-06-23T20:12:52.331Z caller=main.go:255 level=info msg="Starting blackbox_exporter" version="(version=0.21.0, branch=HEAD, revision=148a9de0681062f9680bd
239d16d4a92678b4bc8)"ts=2022-06-23T20:12:52.332Z caller=main.go:256 level=info build_context="(go=go1.18.2, user=root@340341332f2f, date=20220530-12:48:35)"ts=2022-06-23T20:12:52.332Z caller=main.go:259 level=error msg="Error loading config" err="error parsing config file: yaml: unmarshal errors:\n  line 1: cannotunmarshal !!seq into config.plain"

I guess I am doing terribly wrong but and my apologies for that because i am entirely new to this, could you please correct me  where I am doing in Blackbox Exporter 

Currently, I am running the below YAML and it's working fine

modules:
  http_2xx:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
      valid_status_codes: []  # Defaults to 2xx
      method: GET

surendra matta

unread,
Jun 23, 2022, 4:39:24 PM6/23/22
to Prometheus Users
Finally i am able to figure it out and it's working for me - Thanks
Reply all
Reply to author
Forward
0 new messages