# fluent-plugin-jfrog-metrics [Fluentd](https://fluentd.org/) input plugin to scrape metrics from JFrog Artifactory and Xray openmetrics API endpoints and export them to Fluentd to process into various outputs ## Building To build / test locally use rake: ``` rake ``` To build install locally use bundler: ``` bundle install ``` This will install the gem shown below from source. ## Development ### Bundler Add following line to your Gemfile: ```ruby gem "fluent-plugin-jfrog-metrics" ``` And then execute: ``` $ bundle ``` ### Configuration You can generate configuration template: ``` $ fluent-plugin-config-format input jfrog-metrics ``` You can copy and paste generated documents here. ## Installation ### RubyGems ``` $ gem install rest-client ``` ``` $ gem install thread ``` ``` $ gem install fluent-plugin-jfrog-metrics ``` ### Setup & configuration Fluentd is the supported log collector for this integration. For Fluentd setup and information, read the JFrog log analytics repository's [README.](https://github.com/jfrog/log-analytics/blob/master/README.md) #### Fluentd Output Download fluentd conf for different log-vendors. For example Splunk: Splunk setup can be found at [README.](https://github.com/jfrog/metrics/blob/main/splunk/README.md) ```text wget https://raw.githubusercontent.com/jfrog/metrics/master/splunk/splunk_metrics.conf ``` #### Configuration parameters Integration is done by setting up Xray. Obtain JPD url and access token for API. Configure the source directive parameters specified below - **tag** (string) (required): The value is the tag assigned to the generated metrics. - **jpd_url** (string) (required): JPD url required to pull metrics, (note - if deployed on K8s use the localhost and port number combination per sidecar) - **username** (string) (required): USER is the Artifactory username for authentication - **apikey** (string) (required if token is not used, do refer Note section for specifics): API Key is the [Artifactory API Key](https://www.jfrog.com/confluence/display/JFROG/User+Profile#UserProfile-APIKey) for authentication - **token** (string) (required if apikey is not used, do refer Note section for specifics): Admin token is the [Artifactory Scoped Tokens](https://www.jfrog.com/confluence/display/JFROG/Access+Tokens#AccessTokens-GeneratingAdminTokens) for authentication - **metric_prefix** (string) (required): This values pulls the specific metrics. Values can be - jfrog.artifactory, jfrog.xray - **execution_interval** (integer) (optional): Wait interval between pulling new events (scheduler) - Default value: `60` - **request_timeout** (integer) (optional): Http request timeout when calling Artifactory/Xray to pull new events (http client) - Default value: `20` - **common_jpd** (true / false) (optional): This flag should be set as true only for non-kubernetes installations or installations where JPD base URL is same to access both Artifactory and Xray, - ex: https://sample_base_url/artifactory or https://sample_base_url/xray - Default value: false - **target_platform** (string) (optional): The target log-vendor ("SPLUNK", "NEWRELIC" or "DATADOG") - Default value: `SPLUNK` - **verify_ssl** (true / false) (optional): This flag should be set as false in order to bypass client's ssl certificate verification. When false, sets ssl_opts['verify_ssl'] to OpenSSL::SSL::VERIFY_NONE. Otherwise, sets ssl_opts['verify_ssl'] to OpenSSL::SSL::VERIFY_PEER - Default value: true Note: - For Artifactory v7.4 and below only API Key must be used, - For Artifactory v7.4 to 7.46 either Token or API Key can be used, - For Artifactory v7.47 and above token only must be used. ## Copyright * Copyright(c) 2024 - JFrog * Maintainers - MahithaB, BenHarosh * License - Apache License, Version 2.0