Skip to content

Commit

Permalink
Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
peimanja committed Jan 8, 2020
1 parent d4683cc commit 2a2bcd6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This exporter is under development and more metrics will be added later. Tested

## Authentication

The Artifactory provider supports multiple means of authentication. The following methods are supported:
The Artifactory exporter supports multiple means of authentication. The following methods are supported:
* Basic Auth
* Bearer Token

Expand Down

25 comments on commit 2a2bcd6

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peimanja could you please share what should I add in my prometheus.yaml file in order to receive all this metrics mentioned in this exported README file.

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peimanja could you please share what should I add in my prometheus.yaml file in order to receive all this metrics mentioned in this exported README file.

Similar to all Prometheus exporters, you need to add a scrape config for this exporter to collect the metrics for example:

  - job_name: 'artifactory-exporter'
    static_configs:
      - targets: ['artifactory-exporter.domain.com:9531']
        labels:
          env:  prod
    relabel_configs:
      - source_labels: ['__address__']
        target_label: 'node'

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peimanja I can see only below metrics only after installing this image and I can see the container is up and running.

curl localhost:9531/metrics | grep arti

------------->
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0# 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_scrapes Current total artifactory scrapes.

TYPE artifactory_exporter_total_scrapes counter

artifactory_exporter_total_scrapes 4

HELP artifactory_up Was the last scrape of Artifactory successful.

TYPE artifactory_up gauge

artifactory_up 0
100 6511 0 6511 0 0 97k 0 --:--:-- --:--:-- --:--:-- 97k

@peimanja
Copy link
Owner Author

@peimanja peimanja commented on 2a2bcd6 Jan 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vpbobade Please open an issue so others can also benefit from your question or issue: https://github.com/peimanja/artifactory_exporter/issues/new/choose

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peimanja sure will do . In the meantime - i think this has something to do with the datasource connector . could you please help me what should be my env variable to connect to datasource of prometheus.

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

artifactory_up 0 indicates that there was an error scraping Artifactory. What is the error in the logs? what is your configuration? can you please provide more information?

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah - I am just seeing the above 4 metrics and something it has to do with the licensing ..

Logs

level=info ts=2020-01-16T05:48:48.894Z caller=main.go:30 msg="Listening on address" address=:9531
level=error ts=2020-01-16T05:49:42.936Z caller=collector.go:186 msg="Can't scrape Artifactory when fetching system/license" err="HTTP status 401"
level=error ts=2020-01-16T05:49:50.808Z caller=collector.go:186 msg="Can't scrape Artifactory when fetching system/license" err="HTTP status 401"
level=error ts=2020-01-16T05:49:58.224Z caller=collector.go:186 msg="Can't scrape Artifactory when fetching system/license" err="HTTP status 401"

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the user you are using for the exporter has admin rights? 401 means unauthorized so it looks like lack of permissions to hit that end point.

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using root and admin as a user only

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have now provided the data source credentials and the I cannot see 0 in front of artifactory_up now -- but still seeing the same limited metrics here - Does it have to do something with licensing?
`

curl localhost:9531/metrics | egrep 'TYPE' | awk -F" " '{ print $3 }' | grep arti
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6518 0 6518 0 0 111k 0 --:--:-- --:--:-- --:--:-- 113k
artifactory_exporter_json_parse_failures
artifactory_exporter_total_scrapes
artifactory_up

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please paste the whole output of curl localhost:9531/metrics?

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl localhost:9531/metrics | egrep 'TYPE' | awk -F" " '{ print $3 }'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6517 0 6517 0 0 90513 0 --:--:-- --:--:-- --:--:-- 90513
artifactory_exporter_json_parse_failures
artifactory_exporter_total_scrapes
artifactory_up
go_gc_duration_seconds
go_goroutines
go_info
go_memstats_alloc_bytes
go_memstats_alloc_bytes_total
go_memstats_buck_hash_sys_bytes
go_memstats_frees_total
go_memstats_gc_cpu_fraction
go_memstats_gc_sys_bytes
go_memstats_heap_alloc_bytes
go_memstats_heap_idle_bytes
go_memstats_heap_inuse_bytes
go_memstats_heap_objects
go_memstats_heap_released_bytes
go_memstats_heap_sys_bytes
go_memstats_last_gc_time_seconds
go_memstats_lookups_total
go_memstats_mallocs_total
go_memstats_mcache_inuse_bytes
go_memstats_mcache_sys_bytes
go_memstats_mspan_inuse_bytes
go_memstats_mspan_sys_bytes
go_memstats_next_gc_bytes
go_memstats_other_sys_bytes
go_memstats_stack_inuse_bytes
go_memstats_stack_sys_bytes
go_memstats_sys_bytes
go_threads
process_cpu_seconds_total
process_max_fds
process_open_fds
process_resident_memory_bytes
process_start_time_seconds
process_virtual_memory_bytes
process_virtual_memory_max_bytes
promhttp_metric_handler_requests_in_flight
promhttp_metric_handler_requests_total

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peimanja I can see below line in your https://registry.hub.docker.com/r/peimanja/artifactory_exporter could you suggest if its that is the root cause here.

Some metrics are not available with Artifactory OSS license. The exporter returns the following metrics:

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is your license OSS? also I wanted to see the value of metrics. Is artifactory_up 0 or 1? if it is 0 then there should be some errors still in the logs.

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you can see above comment its not zero neither 1 - there is nothing infront of it . it is just as below:

artifactory_up

I am not sure about the license as of now . Yeah there are errors in the logs .

level=info ts=2020-01-16T06:31:08.019Z caller=main.go:30 msg="Listening on address" address=:9531
level=error ts=2020-01-16T06:31:40.786Z caller=collector.go:186 msg="Can't scrape Artifactory when fetching system/license" err="HTTP status 401"

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

401 still indicates that users doesn’t have admin permission. If you do just curl localhost:9531/metrics, you would see the value of the metrics as well.

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curl localhost:9531/metrics | grep -v ^#
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6515 0 6515 0 artifactory_exporter_json_parse_failures 0:-- 0
artifactory_exporter_total_scrapes 5
artifactory_up 0
go_gc_duration_seconds{quantile="0"} 0
go_gc_duration_seconds{quantile="0.25"} 0
0go_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
1go_gc_duration_seconds_count 0
0go_goroutines 7
9go_info{version="go1.13.6"} 1
kgo_memstats_alloc_bytes 1.379768e+06
go_memstats_alloc_bytes_total 1.379768e+06
go_memstats_buck_hash_sys_bytes 1.443049e+06
go_memstats_frees_total 483
go_memstats_gc_cpu_fraction 0
go_memstats_gc_sys_bytes 2.240512e+06
go_memstats_heap_alloc_bytes 1.379768e+06
0go_memstats_heap_idle_bytes 6.4585728e+07
go_memstats_heap_inuse_bytes 2.097152e+06
-go_memstats_heap_objects 5941
-go_memstats_heap_released_bytes 6.4520192e+07
:go_memstats_heap_sys_bytes 6.668288e+07
-go_memstats_last_gc_time_seconds 0
-go_memstats_lookups_total 0
:go_memstats_mallocs_total 6424
-go_memstats_mcache_inuse_bytes 3472
-go_memstats_mcache_sys_bytes 16384
go_memstats_mspan_inuse_bytes 26792
--:--:-- --:--:-- 109k
go_memstats_mspan_sys_bytes 32768
go_memstats_next_gc_bytes 4.473924e+06
go_memstats_other_sys_bytes 789519
go_memstats_stack_inuse_bytes 425984
go_memstats_stack_sys_bytes 425984
go_memstats_sys_bytes 7.1631096e+07
go_threads 8
process_cpu_seconds_total 0.19
process_max_fds 1024
process_open_fds 8
process_resident_memory_bytes 9.8304e+06
process_start_time_seconds 1.57915626741e+09
process_virtual_memory_bytes 5.705728e+08
process_virtual_memory_max_bytes -1
promhttp_metric_handler_requests_in_flight 1
promhttp_metric_handler_requests_total{code="200"} 4
promhttp_metric_handler_requests_total{code="500"} 0
promhttp_metric_handler_requests_total{code="503"} 0

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep so artifactory_up 0 and from logs, looks like the user does not have admin permissions. you can confirm this by hitting that end-point:

curl -u "<username>:<password>" http://<artifactory-url>/api/system/license

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am getting many metrics now however now the below new error in logs

level=error ts=2020-01-16T07:38:43.447Z caller=collector.go:266 msg="Can't scrape Artifactory when fetching replications" err="HTTP status 405"
level=error ts=2020-01-16T07:38:48.527Z caller=collector.go:266 msg="Can't scrape Artifactory when fetching replications" err="HTTP status 405"
level=error ts=2020-01-16T07:40:28.472Z caller=collector.go:266 msg="Can't scrape Artifactory when fetching replications" err="HTTP status 405"
level=error ts=2020-01-16T07:40:39.185Z caller=collector.go:266 msg="Can't scrape Artifactory when fetching replications" err="HTTP status 405"

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is your license? if it is Pro, that might be the issue since I have not tested that.
This metric show you the license:

artifactory_system_license{type="????"}

or you can get that directly:

curl -u "<username>:<password>" http://<artifactory-url>/api/system/license

@vpbobade
Copy link

@vpbobade vpbobade commented on 2a2bcd6 Jan 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not seems to be Pro. using trial only -

"type" : "Trial",
"validThrough" : "Dec 18, 2019",
"licensedTo" : "******"

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be the issue. I will have a fix later on to ignore repository metrics for Trial licenses

@peimanja
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19

@vpbobade
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this. Could you also help in understanding on how can I export my json(files)/dashboards in grafana .

Important thing here is my grafana is running insider a container and I would need to get my dashboards from inside it.

Please sign in to comment.