Skip to content

Commit

Permalink
style(nextcloud): style edits
Browse files Browse the repository at this point in the history
  • Loading branch information
x8a committed May 22, 2023
1 parent 152967c commit 15cd3e8
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ metaDescription: Install our Nextcloud dashboards and see your Nextcloud perform

import infrastructureNextcloudIntegration from 'images/infrastructure_screenshot-full_Nextcloud-integration.webp'

import infrastructureNextcloudAuth from 'images/infrastructure_screenshot-full_Nextcloud-auth.webp'

With our Nextcloud dashboard, you can easily track the number of files in your system, your user accounts, and your database size. Built with our infrastructure agent and Prometheus OpenMetrics integration, the Nextcloud integration gives you a set of default <InlinePopover type="dashboards" /> that let you view your most critical data all in one place.

<img
Expand All @@ -19,12 +21,13 @@ With our Nextcloud dashboard, you can easily track the number of files in your s
After setting up the Nextcloud integration with New Relic, your data displays in dashboards like these right out of the box.
</figcaption>

**Prerequisites**
## Prerequisites

To get your Nextcloud data in New Relic, you need to:

* [Install Go](https://go.dev/doc/install) and make (if required).
* Use Nextcloud 22 or later.
* [Install Go](https://go.dev/doc/install)
* Install the `make` command
* Use Nextcloud 22 or later

## Install the infrastructure agent [#infra]

Expand All @@ -33,7 +36,7 @@ To get data into New Relic, install our infrastructure agent. Our infrastructure
You can install the infrastructure agent two different ways:

* Our [guided install](https://one.newrelic.com/nr1-core?state=4f81feab-35f7-e97e-9903-52510f8542bd) is a CLI tool that inspects your system and installs the infrastructure agent alongside the application monitoring agent that best works for your system. To learn more about how our guided install works, check out our [Guided install overview](/docs/infrastructure/host-integrations/installation/new-relic-guided-install-overview).
* If youd rather install our infrastructure agent manually, you can follow a tutorial for manual installation for [Linux](/docs/infrastructure/install-infrastructure-agent/linux-installation/install-infrastructure-monitoring-agent-linux), [Windows](/docs/infrastructure/install-infrastructure-agent/windows-installation/install-infrastructure-monitoring-agent-windows/), or [macOS](/docs/infrastructure/install-infrastructure-agent/macos-installation/install-infrastructure-monitoring-agent-macos/).
* If you'd rather install our infrastructure agent manually, you can follow a tutorial for manual installation for [Linux](/docs/infrastructure/install-infrastructure-agent/linux-installation/install-infrastructure-monitoring-agent-linux), [Windows](/docs/infrastructure/install-infrastructure-agent/windows-installation/install-infrastructure-monitoring-agent-windows/), or [macOS](/docs/infrastructure/install-infrastructure-agent/macos-installation/install-infrastructure-monitoring-agent-macos/).

## Export Nextcloud data [#export]

Expand All @@ -45,75 +48,59 @@ To start the integration process, you need to export your Nextcloud metrics with
id="export"
title="Export your Nextcloud data"
>
1. Run the following Docker commands to access `nextcloud-exporter`:

```
docker pull ghcr.io/xperimental/nextcloud-exporter:latest
docker pull xperimental/nextcloud-exporter:latest
```

2. Clone `nextcloud-exporter`:

```
git clone https://github.com/xperimental/nextcloud-exporter.git
```

3. Create a binary file in the `nextcloud-exporter` folder named `nextcloud-exporter` using `make`.
```
make
```
A binary file named `nextcloud-exporter` should be created inside the nextcloud-exporter folder.
1. Run the following Docker commands to access `nextcloud-exporter`:
```shell
docker pull ghcr.io/xperimental/nextcloud-exporter:latest
docker pull xperimental/nextcloud-exporter:latest
```

2. Clone `nextcloud-exporter`:
```shell
git clone https://github.com/xperimental/nextcloud-exporter.git
```

3. In your `nextcloud-exporter` folder, create a binary file by using the `make` command:
```shell
make
```
You'll find a binary file named `nextcloud-exporter` inside your `nextcloud-exporter` folder.
</Collapser>

</Collapser>
<Collapser
className="freq-link"
id="token"
title="Complete token authentication"
>

1. To authenticate your token, you need to login to Nextcloud and follow the below steps:

1. Go to `Personal Setting` and click on `Security` from the left side menu bar.
2. Find `Devices & Sessions` , enter app name and click on `Create New App Password`.
3. Copy the TOKEN to use it in nextcloud-exporter configuration (occ command will execute with this token).
4. Set the token using the occ command by going to path of Nextcloud :

<Callout variant="tip">
Nextcloud path can vary based on your Nextcloud setup.
</Callout>

```
/var/www/html/nextcloud
```
```
sudo -u www-data php /var/www/html/nextcloud/occ config:app:set serverinfo token --value "<TOKEN>"
```

2. From your cloned nextcloud-exporter folder, run the following command to initiate username and password authentication:

```
./nextcloud-exporter --login <USERNAME> <PASSWORD> --server http://127.0.0.1/nextcloud
```

Copy output url, run on browser and you’ll find page like attached screenshot:

<img width="1029" alt="connectAccount" src="https://github.com/newrelic/docs-website/assets/101187392/39f7e1c8-9224-4437-a468-2b5b2045da9b">


Click on ‘Log in’, grant access and get the message `Account connected`. Now you’ll receive a username with an encrypted password on the terminal.


3. To access metrics for Nextcloud, run the following command from your cloned nextcloud-exporter folder:

<Callout variant="tip">
Use password which is shown as output after step 6.
</Callout>

```
./nextcloud-exporter -u <YOUR_USERNAME> -p <ENCRYPTED_PASSWORD> --server http://127.0.0.1/nextcloud
```

4. From your browser, go to `http:127.0.0.1:9205/metrics` to view your metrics.
1. To authenticate your tokenm login to Nextcloud and go to **Personal Setting**, and from the left hand-side menu, click **Security**.
2. Under **Devices & Sessions**, enter an app name and click **Create New App Password**.
3. Copy the token to use it in `nextcloud-exporter` configuration. You'll need the token later.
4. Go to your local Nextcloud path, for example `/var/www/html/nextcloud`, and set the token by running:
```shell
sudo -u www-data php /var/www/html/nextcloud/occ config:app:set serverinfo token --value "YOUR_TOKEN"
```
5. In your `nextcloud-exporter` folder, run the following command to authenticate yourself:
```shell
./nextcloud-exporter --login YOUR_USERNAME YOUR_PASSWORD --server http://127.0.0.1/nextcloud
```

Copy the URL the command outputs and paste it in your browser.
6. Click **Log in**, grant access and you'll see the `Account connected` message. Now you'll receive a username with an encrypted password on the terminal.
<img
title="Screenshot of Nextcloud dashboard"
src={infrastructureNextcloudAuth}
/>

<figcaption>
Authenticate yourself by logging in.
</figcaption>

7. To access your Nextcloud metrics, run the following command from your local `nextcloud-exporter` folder:
```shell
./nextcloud-exporter -u YOUR_USERNAME -p YOUR_ENCRYPTED_PASSWORD --server http://127.0.0.1/nextcloud
```

8. From your browser, go to `http:127.0.0.1:9205/metrics` to view your metrics.
</Collapser>
</CollapserGroup>

Expand All @@ -122,67 +109,107 @@ A binary file named `nextcloud-exporter` should be created inside the nextcloud-
With the infrastructure agent installed, you need to establish a line of communication between Nextcloud and New Relic with our Prometheus OpenMetrics integration. Prometheus OpenMetrics scrapes your exposed Nextcloud data so they appear in our prebuilt dashboards.

1. Follow our instructions to install our [Prometheus OpenMetrics integration](/docs/infrastructure/prometheus-integrations/install-configure-openmetrics/install-update-or-uninstall-your-prometheus-openmetrics-integration).
2. Create a file named `nri-prometheus.config.yml` on the below path.

```
/etc/newrelic-infra/integrations.d
```
3. Update the `nri-prometheus.config.yml` file to match our snippet in the [`nri-prometheus` repository](https://github.com/newrelic/nri-prometheus/blob/main/configs/nri-prometheus-config.yml.sample).
3. To get server-related information, replace the URL inside the targets. The replacement URL should match the URL associated with your exposed Nextcloud metrics:

```
targets:
urls: ["http://127.0.0.1:9205"]
```

5. Follow our doc to [restart your New Relic infrastructure service](/docs/infrastructure/install-infrastructure-agent/manage-your-agent/start-stop-restart-infrastructure-agent).
6. Install the [Nextcloud quickstart](https://newrelic.com/instant-observability/nextcloud) to get your pre-built dashboards.
2. Navigate to `/etc/newrelic-infra/integrations.d`, the folder you installed the Prometheus OpenMetrics integration in, and create a file named `nri-prometheus.config.yml`.
3. To get server-related information, replace the URL inside the targets in our [sample file](https://github.com/newrelic/nri-prometheus/blob/main/configs/nri-prometheus-config.yml.sample). The URL should match the URL associated with your exposed Nextcloud metrics:
```yml
integrations:
- name: nri-prometheus
config:
# When standalone is set to false nri-prometheus requires an infrastructure agent to work and send data. Defaults to true
standalone: false

# When running with infrastructure agent emitters will have to include infra-sdk
emitters: infra-sdk

# The name of your cluster. It's important to match other New Relic products to relate the data.
cluster_name: "my_exporter"

targets:
- description: Secure etcd example
urls: ["http://127.0.0.1:9205"]
# tls_config:
# ca_file_path: "/etc/etcd/etcd-client-ca.crt"
# cert_file_path: "/etc/etcd/etcd-client.crt"
# key_file_path: "/etc/etcd/etcd-client.key"

# Whether the integration should run in verbose mode or not. Defaults to false.
verbose: false

# Whether the integration should run in audit mode or not. Defaults to false.
# Audit mode logs the uncompressed data sent to New Relic. Use this to log all data sent.
# It does not include verbose mode. This can lead to a high log volume, use with care.
audit: false

# The HTTP client timeout when fetching data from endpoints. Defaults to "5s" if it is not set.
# scrape_timeout: "5s"

# Length in time to distribute the scraping from the endpoints. Default to "30s" if it is not set.
scrape_duration: "5s"

# Number of worker threads used for scraping targets.
# For large clusters with many (>400) endpoints, slowly increase until scrape
# time falls between the desired `scrape_duration`.
# Increasing this value too much will result in huge memory consumption if too
# many metrics are being scraped.
# Default: 4
# worker_threads: 4

# Whether the integration should skip TLS verification or not. Defaults to false.
insecure_skip_verify: false

timeout: 10s
```

4. [Restart your New Relic infrastructure service](/docs/infrastructure/install-infrastructure-agent/manage-your-agent/start-stop-restart-infrastructure-agent).
5. Install the [Nextcloud quickstart](https://newrelic.com/instant-observability/nextcloud) to get our pre-built dashboards.

## Query your data using NRQL
You can use this sample query to view your Lighttpd metrics captured on [one.newrelic.com](https://one.newrelic.com/all-capabilities):

Here's an example of NRQL query checking the number of active users for the last 5 minutes.
```
SELECT latest(nextcloud_active_users_total) FROM Metric
```
Use this sample query to view your Lighttpd metrics captured on **[one.newrelic.com](https://one.newrelic.com/all-capabilities)**:

Here's an example of NRQL query checking the number of active users in the last 24 hours.
```
SELECT latest(nextcloud_active_users_daily_total) FROM Metric
```
Here's an example of NRQL query checking the number of active users for the last 5 minutes:
```sql
SELECT latest(nextcloud_active_users_total) FROM Metric
```

Here's an example of NRQL query checking the number of active users in the last 24 hours:
```sql
SELECT latest(nextcloud_active_users_daily_total) FROM Metric
```

## What's next?

To learn more about building NRQL queries and generating dashboards, check out these docs:
To learn more about building NRQL queries and generating dashboards:

* [Introduction to the query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) to create basic and advanced queries.
* [Introduction to dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards) to customize your dashboard and carry out different actions.
* [Manage your dashboard](/docs/query-your-data/explore-query-data/dashboards/manage-your-dashboard) to adjust your <InlinePopover type="dashboards" /> display mode, or to add more content to your dashboard.
* Read our [introduction to the query builder](/docs/query-your-data/explore-query-data/query-builder/introduction-query-builder) to create basic and advanced queries.
* Read our [introduction to dashboards](/docs/query-your-data/explore-query-data/dashboards/introduction-dashboards) to customize your dashboard and carry out different actions.
* See how to [manage your dashboard](/docs/query-your-data/explore-query-data/dashboards/manage-your-dashboard) to adjust your <InlinePopover type="dashboards" /> display mode, or to add more content to your dashboard.

## Troubleshoot your issues:
## Troubleshooting

Every time you open a page in Nextcloud you are greeted with the message:
`Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.`

![nextcloud_bug](https://github.com/newrelic/docs-website/assets/101187392/26f01099-ab31-490d-91d2-7ea8e616f473)
### Problem

Solution:

Check the status of Nextcloud encryption:
```
sudo -u www-data php /var/www/html/occ encryption:status
Every time you open a page in Nextcloud, you see this error message:

```shell
Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.
```
### Solution
If you see “enabled: false”, enable the encryption:
```
sudo -u www-data php /var/www/html/occ encryption:enable
```
1. Check the status of the Nextcloud encryption by running:
```shell
sudo -u www-data php /var/www/html/occ encryption:status
```
Verify that “enabled: true” has taken place:
```
sudo -u www-data php /var/www/html/occ encryption:status
```
2. If you see `enabled: false`, enable the encryption by running:
```shell
sudo -u www-data php /var/www/html/occ encryption:enable
```
Now you can exit the Nextcloud and refresh your Nextcloud browser session. You are free to enjoy your Nextcloud without the annoying greeting.

3. Verify that the encryption is enabled by running:
```shell
sudo -u www-data php /var/www/html/occ encryption:status
```
Now, exit Nextcloud and refresh your Nextcloud browser session. You shouldn't see the error message anymore.
Binary file not shown.

0 comments on commit 15cd3e8

Please sign in to comment.