peimanja / artifactory_exporter

JFrog Artifactory Prometheus Exporter written in Go
Apache License 2.0
141 stars 37 forks source link

artifactory_up 0 with no error #63

Closed david-loe closed 2 years ago

david-loe commented 2 years ago

Overview of the Issue

I can not scrape an artifactory instance over the internet. Using docker in a corporate environment, behind a proxy (docker proxy is setup this way)
Not even an error shows up..

Logs

$ docker run --env-file=artifactory/artifactory.env -p 9531:9531 peimanja/artifactory_exporter:latest --log.level=debug
level=info ts=2021-11-22T08:54:16.766Z caller=artifactory_exporter.go:30 msg="Starting artifactory_exporter" version="(version=, branch=refs/heads/master, revision=cae4dbf6f22a924747feb4712f991266520f2a69)"
level=info ts=2021-11-22T08:54:16.766Z caller=artifactory_exporter.go:31 msg="Build context" context="(go=go1.17.2, user=, date=2021-10-20T06:05:06Z)"
level=info ts=2021-11-22T08:54:16.766Z caller=artifactory_exporter.go:32 msg="Listening on address" address=:9531
level=debug ts=2021-11-22T08:54:30.790Z caller=system.go:66 msg="Fetching license stats"
level=debug ts=2021-11-22T08:54:30.790Z caller=utils.go:21 msg="Fetching http" path=https://MYADRESS/artifactory/api/system/license

.env

WEB_TELEMETRY_PATH=/metrics
ARTI_SCRAPE_URI=https://MYADRESS/artifactory
ARTI_ACCESS_TOKEN=***
ARTI_TIMEOUT=5s
ARTI_SSL_VERIFY=false

localhost:9531/metrics

# HELP artifactory_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which artifactory_exporter was built.
# TYPE artifactory_exporter_build_info gauge
artifactory_exporter_build_info{branch="refs/heads/master",goversion="go1.17.2",revision="cae4dbf6f22a924747feb4712f991266520f2a69",version=""} 1
# HELP artifactory_exporter_json_parse_failures Number of errors while parsing Json.
# TYPE artifactory_exporter_json_parse_failures counter
artifactory_exporter_json_parse_failures 0
# HELP artifactory_exporter_total_api_errors Current total API errors.
# TYPE artifactory_exporter_total_api_errors counter
artifactory_exporter_total_api_errors 1
# HELP artifactory_exporter_total_scrapes Current total artifactory scrapes.
# TYPE artifactory_exporter_total_scrapes counter
artifactory_exporter_total_scrapes 1
# HELP artifactory_up Was the last scrape of artifactory successful.
# TYPE artifactory_up gauge
artifactory_up 0
# HELP go_gc_duration_seconds A summary of the GC invocation durations.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
go_gc_duration_seconds{quantile="0.5"} 0
go_gc_duration_seconds{quantile="0.75"} 0
go_gc_duration_seconds{quantile="1"} 0
go_gc_duration_seconds_sum 0
go_gc_duration_seconds_count 0
# HELP go_goroutines Number of goroutines that currently exist.
# TYPE go_goroutines gauge
go_goroutines 10
# HELP go_info Information about the Go environment.
# TYPE go_info gauge
go_info{version="go1.17.2"} 1
# HELP go_memstats_alloc_bytes Number of bytes allocated and still in use.
# TYPE go_memstats_alloc_bytes gauge
go_memstats_alloc_bytes 647920
# HELP go_memstats_alloc_bytes_total Total number of bytes allocated, even if freed.
# TYPE go_memstats_alloc_bytes_total counter
go_memstats_alloc_bytes_total 647920
# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table.
# TYPE go_memstats_buck_hash_sys_bytes gauge
go_memstats_buck_hash_sys_bytes 4062
# HELP go_memstats_frees_total Total number of frees.
# TYPE go_memstats_frees_total counter
go_memstats_frees_total 144
# HELP go_memstats_gc_cpu_fraction The fraction of this program's available CPU time used by the GC since the program started.
# TYPE go_memstats_gc_cpu_fraction gauge
go_memstats_gc_cpu_fraction 0
# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata.
# TYPE go_memstats_gc_sys_bytes gauge
go_memstats_gc_sys_bytes 3.918968e+06
# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and still in use.
# TYPE go_memstats_heap_alloc_bytes gauge
go_memstats_heap_alloc_bytes 647920
# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used.
# TYPE go_memstats_heap_idle_bytes gauge
go_memstats_heap_idle_bytes 2.080768e+06
# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use.
# TYPE go_memstats_heap_inuse_bytes gauge
go_memstats_heap_inuse_bytes 1.687552e+06
# HELP go_memstats_heap_objects Number of allocated objects.
# TYPE go_memstats_heap_objects gauge
go_memstats_heap_objects 2556
# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS.
# TYPE go_memstats_heap_released_bytes gauge
go_memstats_heap_released_bytes 2.048e+06
# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system.
# TYPE go_memstats_heap_sys_bytes gauge
go_memstats_heap_sys_bytes 3.76832e+06
# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection.
# TYPE go_memstats_last_gc_time_seconds gauge
go_memstats_last_gc_time_seconds 0
# HELP go_memstats_lookups_total Total number of pointer lookups.
# TYPE go_memstats_lookups_total counter
go_memstats_lookups_total 0
# HELP go_memstats_mallocs_total Total number of mallocs.
# TYPE go_memstats_mallocs_total counter
go_memstats_mallocs_total 2700
# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures.
# TYPE go_memstats_mcache_inuse_bytes gauge
go_memstats_mcache_inuse_bytes 7200
# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system.
# TYPE go_memstats_mcache_sys_bytes gauge
go_memstats_mcache_sys_bytes 16384
# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures.
# TYPE go_memstats_mspan_inuse_bytes gauge
go_memstats_mspan_inuse_bytes 37264
# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system.
# TYPE go_memstats_mspan_sys_bytes gauge
go_memstats_mspan_sys_bytes 49152
# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place.
# TYPE go_memstats_next_gc_bytes gauge
go_memstats_next_gc_bytes 4.473924e+06
# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations.
# TYPE go_memstats_other_sys_bytes gauge
go_memstats_other_sys_bytes 1.077178e+06
# HELP go_memstats_stack_inuse_bytes Number of bytes in use by the stack allocator.
# TYPE go_memstats_stack_inuse_bytes gauge
go_memstats_stack_inuse_bytes 425984
# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator.
# TYPE go_memstats_stack_sys_bytes gauge
go_memstats_stack_sys_bytes 425984
# HELP go_memstats_sys_bytes Number of bytes obtained from system.
# TYPE go_memstats_sys_bytes gauge
go_memstats_sys_bytes 9.260048e+06
# HELP go_threads Number of OS threads created.
# TYPE go_threads gauge
go_threads 8
# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds.
# TYPE process_cpu_seconds_total counter
process_cpu_seconds_total 0.03
# HELP process_max_fds Maximum number of open file descriptors.
# TYPE process_max_fds gauge
process_max_fds 1.048576e+06
# HELP process_open_fds Number of open file descriptors.
# TYPE process_open_fds gauge
process_open_fds 11
# HELP process_resident_memory_bytes Resident memory size in bytes.
# TYPE process_resident_memory_bytes gauge
process_resident_memory_bytes 7.643136e+06
# HELP process_start_time_seconds Start time of the process since unix epoch in seconds.
# TYPE process_start_time_seconds gauge
process_start_time_seconds 1.63757125571e+09
# HELP process_virtual_memory_bytes Virtual memory size in bytes.
# TYPE process_virtual_memory_bytes gauge
process_virtual_memory_bytes 1.107226624e+09
# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes.
# TYPE process_virtual_memory_max_bytes gauge
process_virtual_memory_max_bytes -1
# HELP promhttp_metric_handler_requests_in_flight Current number of scrapes being served.
# TYPE promhttp_metric_handler_requests_in_flight gauge
promhttp_metric_handler_requests_in_flight 1
# HELP promhttp_metric_handler_requests_total Total number of scrapes by HTTP status code.
# TYPE promhttp_metric_handler_requests_total counter
promhttp_metric_handler_requests_total{code="200"} 0
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0
micemuni commented 2 years ago

@david-loe Please refer https://github.com/peimanja/artifactory_exporter/issues/65

peimanja commented 2 years ago

You are sure there are no errors in the logs ? I see the artifactory_exporter_total_api_errors 1 that normally means there was an error and it should be logged

micemuni commented 2 years ago

I am sure that i didn't seen error from exporter logs, I seen license related error when i ran exporter image as docker like https://github.com/peimanja/artifactory_exporter#docker, then uploaded license then it got fixed, Even now I am getting artifactory_exporter_total_api_errors 3 ( https://github.com/peimanja/artifactory_exporter/issues/65#issuecomment-979010361 ) but it's working fine.

david-loe commented 2 years ago

There is NO error, I've posted the complete log..

https://MYADRESS/artifactory/api/system/license gives me the following response

{
  "type" : "Commercial",
  "validThrough" : "***",
  "licensedTo" : "***"
}

So I don't think it's a license issue.

I believe the proxy is the issue, bc on the local instance of artifactory it works. Maybe the exporter is not able to handle a proxy.

chengglmotto commented 2 years ago

I think that you should set the ip when you run the exporter .like this: docker run --env-file=/usr/local/etc/artifactory-exporter/main.env -p 9531:9531 peimanja/artifactory_exporter:latest --l.level=debug --artifactory.scrape-uri="http://192.168.58.150:8081/artifactory" dockers localhost is containers,not server`s

virtualb0x commented 2 years ago

Have had the same issue. The problem was in k8s coredns configuration. Exporter in container just could't resolve artifactory's ip address from its name.

Maybe it worth to make more clear full output in log messages. We've got a root cause after docker-image rebuilding in aim to access containers shell and curl. Can bw much more easy to investigate if exporter will be able to say it can't resolve or reach artifactory address, not only 2 poor lines about licenses like topic-starter posted:

Fetching http" path=https://MYADRESS/artifactory/api/system/license
github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.