#ISSUE WITH HARVESTER

1 messages · Page 1 of 1 (latest)

high sapphire
#

Hi Team,
i can see harvest data under /var/log/harvest file. But I can't see the data on Prometheus web.

  Datacenter |   Poller   |  PID  | PromPort | Status   
-------------+------------+-------+----------+----------
  DC-01      | landcastle | 32898 |    12991 | running  

Can someone help me I am missing. 

I have downloaded the harvester from GitHub and modified the harvest.yml file and run it directly
coarse pollen
high sapphire
oak canyon
#

@high sapphire What type of installation are you trying? docker, rpm, deb?
Have you added harvest poller scrape point to prometheus configuration as Chris asked above?
Could you share your prometheus configuration?

high sapphire
#

@oak canyon
cat /etc/prometheus/prometheus.yml
global:
scrape_interval: 10s

scrape_configs:

  • job_name: 'prometheus_master'
    scrape_interval: 5s
    static_configs:
    • targets: ['localhost:9090']

scrape_configs:

#

vi harvest.yml
Admin:

Listen address for Prometheus HTTP service discovery end-point

The endpoint is reachable at SCHEMA://<listen>/api/v1/sd

Should be one of: localhost:port, :port, or ip:port

httpsd:
listen: :8887
# listen: localhost:8887

# Basic auth for - /api/v1/sd
 auth_basic:
   username: admin
   password: admin

# create self-signed certs with 'bin/harvest admin tls create server'
# tls:
#   cert_file: cert/admin-cert.pem
#   key_file: cert/admin-key.pem

Tools:

grafana_api_token: 'aaa-bbb-ccc-ddd'

autosupport_disabled: true

Exporters:
prometheus:
exporter: Prometheus
local_http_addr: 0.0.0.0
port: 12990
prometheus1:
exporter: Prometheus
port_range: 13000-14000

Defaults:
collectors:
- Zapi
- ZapiPerf
- Ems
use_insecure_tls: false

Pollers:

This is an optional poller that provides stats about harvest itself.

To remove it, simply delete the "unix" section

add your cDOT / 7Mode pollers below, example:

cluster-01:
datacenter: DC-01
addr: 172.23.140.201
auth_style: basic_auth
credentials_file: path/to/credentials.yml # read credentials from the file
username: admin
password: netapp123
use_insecure_tls: true # Disable TLS verification when connecting to ONTAP cluster
exporters:
- prometheus

no need to add collectors, since they're already defined in Defaults

example with certificate authentication

See https://github.com/NetApp/harvest/blob/main/docs/AuthAndPermissions.md#using-certificate-authentication

cluster-01:

datacenter: DC-01

addr: 10.0.0.2

auth_style: certificate_auth

ssl_cert: /path/to/cert.pem

ssl_key: /path/to/key.key

ca_cert: /path/to/server.crt

GitHub

Open-metrics endpoint for ONTAP . Contribute to NetApp/harvest development by creating an account on GitHub.

#

these are the harvest.yml and prometheus configuration

#

i have installed the rpm

oak canyon
high sapphire
#

hi Rahul,
using the above harvest.yml config when i start the harvest it was not running. Below is the output

#

bin/harvest start
Datacenter | Poller | PID | PromPort | Status
-------------+------------+-----+----------+--------------
DC-01 | cluster-01 | | | not running

oak canyon
#

okay could you share logs for this poller cluster-01. It should be present under /var/log/harvest

high sapphire
oak canyon
#

Ok. In harvest.yaml I see that you are using credentials_file param and also user/pass

high sapphire
oak canyon
#

Issue is there with harvest.yaml. If you are using authentication using user/pass then you can remove credential_file

high sapphire
#

now they are running

#

bin/harvest status
Datacenter | Poller | PID | PromPort | Status
-------------+----------------+-------+----------+----------
Dc -01 | cluster1 | 36661 | 12990 | running
DC-01 | cluster2 | 36669 | 13001 | running

#

can you help me how can i integrate with grafana

oak canyon
#

okay great

#

Could you confirm if you see these metrics in prometheus first?

high sapphire
#

yes with different ports

oak canyon
high sapphire
#

prometheus is not starting

coarse pollen
#

hi @high sapphire does journalctl -u prometheus or systemctl status prometheus say anything?

high sapphire
#

systemctl status prometheus
● prometheus.service - Prometheus
Loaded: loaded (/etc/systemd/system/prometheus.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2022-11-02 18:35:47 IST; 1s ago
Process: 46927 ExecStart=/usr/local/bin/prometheus --config.file /etc/prometheus/prometheus.yml --storage.tsdb.path /var/lib/prometheus/ --web.console.templates=/etc/prometheus/consoles --web.console.libraries=/etc/prometheus/console_libraries (code=exited, status=2)
Main PID: 46927 (code=exited, status=2)

coarse pollen
#

thanks @high sapphire perhaps one of those paths is wrong? does journalctl -u prometheus give anymore details?

high sapphire
coarse pollen
#

thanks. Looks like Prometheus started fine at ts=2022-11-02T09:54:49.954Z did you start it via systemctl then or a different way? And now you are trying to start it via systemctl start prometheus ?

#

you could also try to start directly, skipping your service file, to make sure those commands are correct and to verify it starts that way. That means running this directly /usr/local/bin/prometheus
--config.file /etc/prometheus/prometheus.yml
--storage.tsdb.path /var/lib/prometheus/
--web.console.templates=/etc/prometheus/consoles
--web.console.libraries=/etc/prometheus/console_libraries

high sapphire
#

after changing the below config, promentheus is starting but i don't know below config was correct
cat /etc/prometheus/prometheus.yml
global:
scrape_interval: 10s

scrape_configs:

  • job_name: 'harvest'
    scrape_interval: 5s
    static_configs:
    • targets: ['localhost:9090']

#scrape_configs:

- job_name: 'harvest'

http_sd_configs:

- url: http://localhost:8887/api/v1/sd

#

can you please check and let me know

coarse pollen
#

not sure if you installed promtool but try running promtool check config /etc/prometheus/prometheus.yml

#

when you try to start prometheus, it will also log an error if there are mistakes in the prometheus.yml file

high sapphire
#

prometheus is working

oak canyon
#

Great. Do you see these metrics now in prometheus?

high sapphire
#

i am getting the above

#

@oak canyon my grafana is running on the same server

#

how can i import the data

high sapphire
#

i am seeing attached metrics in prometheus

high sapphire
#

@oak canyon can you help me how to import the dashboard

oak canyon
#

Yes, I see that Harvest metrics aren't visible in prometheus. Could you share the output of curl -s 'http://localhost:8887/api/v1/sd'

high sapphire
oak canyon
#

ok could you check if you have started admin cli?

high sapphire
oak canyon
#

okay looks like you have just started it. This needs to be running if you are using prometheus endpoint discovery. If it goes down then prometheus cannt scrape harvest metrics

#

Let's wait for a minute or 2 and then check again the output of curl -s 'http://localhost:8887/api/v1/sd'

high sapphire
oak canyon
#

Could you share poller log

high sapphire
oak canyon
#

Thanks. yeah logs look ok

oak canyon
high sapphire
#

https is not working

#

you want me to check

oak canyon
#

Hmm this endpoint is on http only and not https

#

Could you share screenshot of page from http://localhost:9090/targets

high sapphire
#

when i check the prometheus below iam seeing
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"
caller=refresh.go:99 level=error component="discovery manager scrape" discovery=http msg="Unable to refresh target g...Unauthorized"

oak canyon
#

I see that you have basic auth enabled for this in harvest.yaml
auth_basic: username: admin password: admin

#

try this curl
curl -u admin:admin 'http://localhost:8887/api/v1/sd'

high sapphire
#

curl -u admin:admin 'http://localhost:8887/api/v1/sd'
[{"targets":["172.23.133.100:12990"],"labels":{"__meta_poller":"landcastle"}},{"targets":[":13003"],"labels":{"__meta_poller":"xhdengcdot1"}},{"targets":[":13001"],"labels":{"__meta_poller":"xhdnstorecdot1"}},{"targets":[":13002"],"labels":{"__meta_poller":"xhditcdot1"}}]

oak canyon
#

great!

#

now we just need to modify prometheus.yml with the proper auth to scrape this endpoint

#

Could you share prometheus.yml

high sapphire
oak canyon
#

let's add below in this job

#

as below
- job_name: harvest http_sd_configs: - url: http://localhost:8887/api/v1/sd basic_auth: username: admin password: admin

high sapphire
#

now i am getting the data

#

can you let me know how to import the grafana

oak canyon
high sapphire
#

@oak canyon i have created the token and updated the token in harvest

#

now can you let me know how to import dashboard

oak canyon
#

Can you run command bin/grafana import --addr localhost:3000

#

that should be run from harvest dir

high sapphire
#

error connect: (403 - 403 Forbidden) You'll need additional permissions to perform this action. Permissions needed: folders:read

oak canyon
high sapphire
oak canyon
#

hmm editor api key should work fine. Let's try with an admin key? Could you change the key in harvest.yaml to a new api key with admin permissions

high sapphire
#

it was working now

#

thank you rahul !

oak canyon
#

great!

#

do you see data in grafana now?

high sapphire
#

yes

high sapphire
#

@coarse pollen @oak canyon , My prometheus services is stopping continusly