### Install go-version Source: https://github.com/netapp/harvest/blob/main/third_party/go-version/README.md Install the go-version library using the standard go get command. ```bash $ go get github.com/hashicorp/go-version ``` -------------------------------- ### Install Tablewriter Source: https://github.com/netapp/harvest/blob/main/third_party/olekukonko/tablewriter/README.md Install the tablewriter package using the go get command. ```bash go get github.com/olekukonko/tablewriter ``` -------------------------------- ### Install tidwall/match Package Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/match/README.md Use 'go get' to install the latest version of the match package. ```go go get -u github.com/tidwall/match ``` -------------------------------- ### Install Pretty Go Package Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/pretty/README.md Use 'go get' to install the Pretty package. This command retrieves the library for use in your Go projects. ```sh go get -u github.com/tidwall/pretty ``` -------------------------------- ### Install timedmap v2 Source: https://github.com/netapp/harvest/blob/main/vendor/github.com/zekroTJA/timedmap/v2/README.md Use 'go get' to install or update the timedmap v2 package. ```bash go get -u github.com/zekroTJA/timedmap/v2 ``` -------------------------------- ### Install Mergo Source: https://github.com/netapp/harvest/blob/main/third_party/mergo/README.md Install the Mergo package using go get. This command fetches and installs the package and its dependencies. ```bash go get dario.cat/mergo ``` -------------------------------- ### Install GJSON Go Package Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/gjson/README.md Use 'go get' to install the GJSON library for your Go project. ```sh go get -u github.com/tidwall/gjson ``` -------------------------------- ### Install Server Certificate with SAN Source: https://github.com/netapp/harvest/blob/main/docs/prepare-cdot-clusters.md Install the server certificate, including its private key, after the CA certificate has been installed. You will be prompted to enter the certificate and private key content. ```bash umeng-aff300-05-06::*> security certificate install -type server Please enter Certificate: Press when done -----BEGIN CERTIFICATE----- .. -----END CERTIFICATE----- Please enter Private Key: Press when done -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- Please enter certificates of Certification Authorities (CA) which form the certificate chain of the server certificate. This starts with the issuing CA certificate of the server certificate and can range up to the root CA certificate. Do you want to continue entering root and/or intermediate certificates {y|n}: n ``` -------------------------------- ### Start Harvest Directly Source: https://github.com/netapp/harvest/blob/main/docs/quickstart.md Starts Harvest directly from the command line for testing purposes before setting up a systemd service. Assumes you are in the Harvest installation directory. ```bash cd ${HARVEST_INSTALL_PATH}/harvest-${HARVEST_VERSION}-1_linux_amd64 bin/harvest start ``` -------------------------------- ### Install SJSON Go Package Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/sjson/README.md Use 'go get' to install the SJSON library. This command retrieves the latest version of the package for use in your Go projects. ```sh go get -u github.com/tidwall/sjson ``` -------------------------------- ### Download and Install Harvest Source: https://github.com/netapp/harvest/blob/main/docs/install/native.md Use this command to download the latest Harvest release using wget and then extract it. After extraction, navigate into the directory and start Harvest with the default collector. ```bash VERSION=23.08.0 wget https://github.com/NetApp/harvest/releases/download/v${VERSION}/harvest-${VERSION}-1_linux_amd64.tar.gz tar -xvf harvest-${VERSION}-1_linux_amd64.tar.gz cd harvest-${VERSION}-1_linux_amd64 # Run Harvest with the default unix localhost collector bin/harvest start ``` -------------------------------- ### Example Harvest System Information Output Source: https://github.com/netapp/harvest/wiki/Troubleshooting-Harvest This is an example of the output you might see when running the 'show system' command. ```text ./bin/harvest -p infinity show system connected to infinity (NetApp Release 9.8P2: Tue Feb 16 03:49:46 UTC 2021) [results] - * [build-timestamp] - 1613447386 [is-clustered] - true [version] - NetApp Release 9.8P2: Tue Feb 16 03:49:46 UTC 2021 [version-tuple] - * [system-version-tuple] - * [generation] - 9 [major] - 8 [minor] - 0 ``` -------------------------------- ### Start Storage VM Source: https://github.com/netapp/harvest/blob/main/docs/resources/ems-alert-runbook.md Use this command to start data access on a storage VM after a 'vserver stop' operation. This is part of the remediation for 'vserver.stop.succeeded' events. ```bash vserver start ``` -------------------------------- ### Set Installation Path for NetApp Harvest Source: https://github.com/netapp/harvest/blob/main/docs/quickstart.md Sets the installation path for NetApp Harvest and creates the directory. Ensure this path is accessible. ```bash HARVEST_INSTALL_PATH=/opt/netapp/harvest mkdir -p ${HARVEST_INSTALL_PATH} ``` -------------------------------- ### Install Server CA Certificate on Cluster Source: https://github.com/netapp/harvest/blob/main/docs/prepare-cdot-clusters.md Log in to your cluster via SSH and install the server certificate authority. Ensure you have the `ca.cert.pem` file available. ```bash ssh admin@IP umeng-aff300-05-06::*> security certificate install -type server-ca Please enter Certificate: Press when done -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- ``` -------------------------------- ### volume_space_expected_available Source: https://github.com/netapp/harvest/blob/main/docs/ontap-metrics.md The size in bytes that should be available for the volume irrespective of available size in the aggregate. This is same as size-available for 'volume' guaranteed volumes. For 'none' guaranteed volumes this value is calculated as if the aggregate has enough backing disk space to fully support the volume's size. Similar to the size-available property, this does not include Snapshot reserve. This count gets reduced if snapshots consume space above Snapshot reserve threshold. This parameter is not supported on Infinite Volumes. ```APIDOC ## volume_space_expected_available ### Description The size (in bytes) that should be available for the volume irrespective of available size in the aggregate. This is same as size-available for 'volume' guaranteed volumes. For 'none' guaranteed volumes this value is calculated as if the aggregate has enough backing disk space to fully support the volume's size. Similar to the size-available property, this does not include Snapshot reserve. This count gets reduced if snapshots consume space above Snapshot reserve threshold. This parameter is not supported on Infinite Volumes. ### API #### REST - **Endpoint**: `api/private/cli/volume` - **Metric**: `expected_available` #### ZAPI - **Method**: `volume-get-iter` - **Metric**: `volume-attributes.volume-space-attributes.expected-available` ``` -------------------------------- ### Install Grafana Source: https://github.com/netapp/harvest/blob/main/docs/quickstart.md Download and extract the Grafana binary. This is the initial step for setting up Grafana. ```bash GRAFANA_VERSION=12.3.2 cd ${HARVEST_INSTALL_PATH} wget https://dl.grafana.com/oss/release/grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz tar -xvf grafana-${GRAFANA_VERSION}.linux-amd64.tar.gz ``` -------------------------------- ### Basic Table Creation Source: https://github.com/netapp/harvest/blob/main/third_party/olekukonko/tablewriter/README.md Demonstrates basic table creation with headers, data rows, and rendering to standard output. ```go data := [][]string{ []string{"A", "The Good", "500"}, []string{"B", "The Very very Bad Man", "288"}, []string{"C", "The Ugly", "120"}, []string{"D", "The Gopher", "800"}, } table := tablewriter.NewWriter(os.Stdout) table.SetHeader([]string{"Name", "Sign", "Rating"}) for _, v := range data { table.Append(v) } table.Render() // Send output ``` -------------------------------- ### Example Pod Output Source: https://github.com/netapp/harvest/blob/main/docs/install/k8.md Sample output showing the status of running pods after deployment. ```text NAME READY STATUS RESTARTS AGE prometheus-666fc7b64d-xfkvk 1/1 Running 0 43m grafana-7cd8bdc9c9-wmsxh 1/1 Running 0 43m u2-7dfb76b5f6-zbfm6 1/1 Running 0 43m ``` -------------------------------- ### Collect Node Power Metrics (FAS2750 Example) Source: https://github.com/netapp/harvest/blob/main/docs/resources/power-algorithm.md This example shows the output of commands used to gather node power metrics for a FAS2750 model. It includes system, chassis, and sensor information. ```bash # Power Metrics for 10.61.183.200 ## ONTAP version NetApp Release 9.8P16: Fri Dec 02 02:05:05 UTC 2022 ## Nodes system show Node | Model | SerialNumber ----------------------+---------+--------------- cies-na2750-g1344-01 | FAS2750 | 621841000123 cies-na2750-g1344-02 | FAS2750 | 621841000124 ## Chassis system chassis fru show ChassisId | Name | Fru | Type | Status | NumNodes | ConnectedNodes ---------------+-----------------+---------------------+------------+--------+----------+------------------------------------------- 021827030435 | 621841000123 | cie-na2750-g1344-01 | controller | ok | 1 | cie-na2750-g1344-01 021827030435 | 621841000124 | cie-na2750-g1344-02 | controller | ok | 1 | cie-na2750-g1344-02 021827030435 | PSQ094182201794 | PSU2 FRU | psu | ok | 2 | cie-na2750-g1344-02, cie-na2750-g1344-01 021827030435 | PSQ094182201797 | PSU1 FRU | psu | ok | 2 | cie-na2750-g1344-02, cie-na2750-g1344-01 ## Sensors system environment sensors show (filtered by power, voltage, current) Node | Name | Type | State | Value | Units ----------------------+---------------+---------+--------+-------+-------- cies-na2750-g1344-01 | PSU1 12V Curr | current | normal | 9920 | mA cies-na2750-g1344-01 | PSU1 12V | voltage | normal | 12180 | mV cies-na2750-g1344-01 | PSU1 5V Curr | current | normal | 4490 | mA cies-na2750-g1344-01 | PSU1 5V | voltage | normal | 5110 | mV cies-na2750-g1344-01 | PSU2 12V Curr | current | normal | 9140 | mA cies-na2750-g1344-01 | PSU2 12V | voltage | normal | 12100 | mV cies-na2750-g1344-01 | PSU2 5V Curr | current | normal | 4880 | mA cies-na2750-g1344-01 | PSU2 5V | voltage | normal | 5070 | mV cies-na2750-g1344-02 | PSU1 12V Curr | current | normal | 9920 | mA cies-na2750-g1344-02 | PSU1 12V | voltage | normal | 12180 | mV cies-na2750-g1344-02 | PSU1 5V Curr | current | normal | 4330 | mA cies-na2750-g1344-02 | PSU1 5V | voltage | normal | 5110 | mV cies-na2750-g1344-02 | PSU2 12V Curr | current | normal | 9170 | mA cies-na2750-g1344-02 | PSU2 12V | voltage | normal | 12100 | mV cies-na2750-g1344-02 | PSU2 5V Curr | current | normal | 4720 | mA cies-na2750-g1344-02 | PSU2 5V | voltage | normal | 5070 | mV ``` -------------------------------- ### Chained Get Operations Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/gjson/README.md Demonstrates multiple ways to chain `Get` operations for accessing nested JSON values. All provided examples yield the same result. ```go gjson.Parse(json).Get("name").Get("last") gjson.Get(json, "name").Get("last") gjson.Get(json, "name.last") ``` -------------------------------- ### Basic Pattern Matching Examples Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/match/README.md Demonstrates matching strings against patterns using '*' and '?'. The '*' wildcard matches any sequence of characters, while '?' matches any single character. ```go match.Match("hello", "*llo") match.Match("jello", "?ello") match.Match("hello", "h*o") ``` -------------------------------- ### Install Client Certificate on NetApp Cluster Source: https://github.com/netapp/harvest/blob/main/docs/prepare-cdot-clusters.md Log in to the cluster via SSH and use the `security certificate install` command to import the client certificate. Ensure the certificate content is correctly formatted between BEGIN and END markers. ```bash ssh admin@IP umeng-aff300-05-06::*> security certificate install -type client-ca -vserver umeng-aff300-05-06 Please enter Certificate: Press when done -----BEGIN CERTIFICATE----- ... -----END CERTIFICATE----- ``` -------------------------------- ### Get Nested Array Values Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/gjson/README.md Access values within nested arrays using the '#' wildcard and array index notation. This example retrieves all last names from a list of programmers. ```go result := gjson.Get(json, "programmers.#.lastName") for _, name := range result.Array() { println(name.String()) } ``` -------------------------------- ### Build Harvest from Source Source: https://github.com/netapp/harvest/blob/main/docs/install/overview.md Follow these steps to clone the repository, set up your Go environment, and build the Harvest binary. Use `GOOS=darwin make build` for macOS. ```bash git clone https://github.com/NetApp/harvest.git ``` ```bash cd harvest ``` ```bash make build ``` ```bash GOOS=darwin make build ``` ```bash bin/harvest version ``` -------------------------------- ### Query Object Inside Array Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/gjson/README.md Filter objects within an array based on their properties and retrieve specific fields. This example gets the first name of the programmer whose last name is 'Hunter'. ```go name := gjson.Get(json, `programmers.#(lastName="Hunter").firstName`) println(name.String()) // prints "Elliotte" ``` -------------------------------- ### Query Harvest Pollers via HTTP Service Discovery Source: https://github.com/netapp/harvest/blob/main/docs/prometheus-exporter.md Example of querying the Harvest HTTP service discovery endpoint to get a list of active pollers. Requires Prometheus version 2.28.0 or later. ```bash curl -s 'http://localhost:8887/api/v1/sd' | jq . ``` -------------------------------- ### Query Harvest Pollers via Prometheus SD API Source: https://github.com/netapp/harvest/wiki/Troubleshooting-Harvest If the admin node is running and configured, you can query its Prometheus Service Discovery API endpoint to get a list of running Harvest pollers. This example uses `curl` and `jq` to format the output. ```bash curl -s -k https://localhost:8887/api/v1/sd | jq . ``` -------------------------------- ### Reload Systemd and Start Harvest Source: https://github.com/netapp/harvest/blob/main/docs/quickstart.md Reloads systemd manager configuration, enables the harvest.target to start on boot, and starts the Harvest service. ```bash sudo systemctl daemon-reload sudo systemctl enable harvest.target sudo systemctl start harvest.target ``` -------------------------------- ### Example: Writing Numeric Data Source: https://github.com/netapp/harvest/blob/main/docs/resources/matrix.md Demonstrates resetting the matrix, setting values using `SetValueString` and `SetValueFloat64`, creating new instances, and setting values with type mismatches, including potential overflow. ```go if err = myMatrix.Reset(); err != nil { return } // write numbers to the matrix using the instance and the metrics we have created // let the metric do the conversion for us if err = speed.SetValueString(instance, "500"); err != nil { logger.Error(me.Prefix, "set speed value: ", err) } // here we ignore err since type is the metric type length.SetValueFloat64(instance, 10000.00) // safe to add new instances var instance2 matrix.Instance if instance2, err = myMatrix.NewInstance("SomeOtherCar"); err != nil { return err } // possible and safe even though speed has type Float32 } if err = length.SetValueInt64(instance2, 13000); err != nil { logger.Error(me.Prefix, "set speed value:", err) } // possible, but will overflow since speed is unsigned } if err = speed.SetValueInt64(instance2, -500); err != nil { logger.Error(me.Prefix, "set length value:", err) } ``` -------------------------------- ### Aggregator Plugin: Example Configurations Source: https://github.com/netapp/harvest/blob/main/docs/plugins.md These examples demonstrate practical applications of the Aggregator plugin, including aggregating by multiple labels, filtering by specific label values, and using regular expressions for matching. ```yaml plugins: Aggregator: # will aggregate metrics of the aggregate. The labels "node" and "type" are included in the new instances - aggr node type # aggregate instances if label "type" has value "flexgroup" # include all original labels - type ... # aggregate all instances if value of "volume" ends with underscore and 4 digits - volume<`_\d{4}$`> ``` -------------------------------- ### Verify Certificate Installation with OpenSSL Source: https://github.com/netapp/harvest/blob/main/docs/prepare-cdot-clusters.md Use `openssl s_client` to confirm that the installed certificates are working correctly. The command should connect successfully and show certificate details. ```bash openssl s_client -CAfile certs/ca.cert.pem -showcerts -servername server -connect umeng-aff300-05-06-cm.rtp.openenglab.netapp.com:443 CONNECTED(00000005) depth=1 C = US, ST = NC, L = RTP, O = ntap, OU = ntap verify return:1 depth=0 verify return:1 ... ``` ```bash openssl s_client -CAfile certs/ca.cert.pem -showcerts -servername server -connect umeng-aff300-05-06-cm.rtp.openenglab.netapp.com:443 ``` ```bash CONNECTED(00000005) depth=0 verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 verify error:num=21:unable to verify the first certificate verify return:1 --- ``` -------------------------------- ### Example yamllint Warning Source: https://github.com/netapp/harvest/wiki/Troubleshooting-Harvest This is an example of a warning that `yamllint` might produce, which is generally acceptable. ```yaml harvest.yml 64:1 warning too many blank lines (3 > 0) (empty-lines) ``` -------------------------------- ### Install Rancher Desktop using Brew Source: https://github.com/netapp/harvest/blob/main/docs/install/containerd.md Use Homebrew to install Rancher Desktop on your macOS system. ```sh brew install rancher ``` -------------------------------- ### Install uniseg Package Source: https://github.com/netapp/harvest/blob/main/vendor/github.com/rivo/uniseg/README.md Use this command to add the uniseg package to your Go project. ```bash go get github.com/rivo/uniseg ``` -------------------------------- ### Show Object Store Configuration Source: https://github.com/netapp/harvest/blob/main/docs/resources/ems-alert-runbook.md Verify the configuration of your object store, including login and connectivity information. This is a troubleshooting step for 'Giveback of Storage Pool Failed' alerts. ```bash aggregate object-store config show ``` -------------------------------- ### Start Podman Systemd Socket Source: https://github.com/netapp/harvest/blob/main/docs/install/podman.md Starts the Podman systemd socket-activated service, which is necessary for Podman to function. ```bash sudo systemctl start podman.socket ``` -------------------------------- ### Start Harvest Containers Source: https://github.com/netapp/harvest/blob/main/docs/install/harvest-containers.md Command to start all Harvest containers defined in the `harvest-compose.yml` file in detached mode. ```bash docker compose -f harvest-compose.yml up -d --remove-orphans ``` -------------------------------- ### Dot vs Pipe Separator Examples Source: https://github.com/netapp/harvest/blob/main/third_party/tidwall/gjson/SYNTAX.md Demonstrates the equivalence and differences between dot (.) and pipe (|) separators in GJSON paths, particularly with array indexing and queries. ```go friends.0.first "Dale" friends|0.first "Dale" friends.0|first "Dale" friends|0|first "Dale" friends|# 3 friends.# 3 friends.#(last="Murphy")# [{"first": "Dale", "last": "Murphy", "age": 44},{"first": "Jane", "last": "Murphy", "age": 47}] friends.#(last="Murphy")#.first ["Dale","Jane"] friends.#(last="Murphy")#|first friends.#(last="Murphy")#.0 [] friends.#(last="Murphy")#|0 {"first": "Dale", "last": "Murphy", "age": 44} friends.#(last="Murphy")#.# [] friends.#(last="Murphy")#|# 2 ```