Skip to content

Commit

Permalink
fix MDX issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyzanchi committed May 2, 2024
1 parent 737dd64 commit 861860e
Show file tree
Hide file tree
Showing 12 changed files with 800 additions and 800 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ Con el monitoreo sintético, puede monitor y probar sus aplicaciones y abordar p

Esta opción verifica la validez de la cadena del certificado SSL. Se puede duplicar ejecutando la siguiente sintaxis:

```sh
openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApath /etc/ssl/certs > /dev/null
```
```sh
openssl s_client -servername {YOUR_HOSTNAME} -connect {YOUR_HOSTNAME}:443 -CApath /etc/ssl/certs > /dev/null
```

* <DoNotTranslate>**Bypass HEAD request (for ping monitors).**</DoNotTranslate>

Expand Down Expand Up @@ -192,131 +192,131 @@ Con el monitoreo sintético, puede monitor y probar sus aplicaciones y abordar p

7. Ahora está listo para escribir su script. Consulte este script de ejemplo para probar el rendimiento de `newrelic.com` y verificar que ciertos elementos se hayan cargado.

```js
/**
* Script Name: Best Practices - Chrome 100
* Author: New Relic
* Version: 1.5
* Purpose: best practices example
* Reference: https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/synthetic-scripted-browser-reference-monitor-versions-chrome-100/
*/

// -------------------- CONSTANTS
const SCRIPT_NAME = "Best Practices - Chrome 100" // name to record in script log
const IMPLICIT_TIMEOUT = 3000 // default implicit timeout is 10 seconds, 3 seconds x 8 findElement operations = 24 seconds, assuming all operations time out
const PAGE_LOAD_TIMEOUT = 60000 // default page load timeout is 60 seconds, fail early to prevent long duration timeouts
const SCRIPT_TIMEOUT = 20000 // default script timeout is 30 seconds
const USER_AGENT = "default" // set the user agent for Chrome
const PROTOCOL = "https://" // set the protocol
const USERNAME = "" // username:
const PASSWORD = "" // password@
const DOMAIN = "docs.newrelic.com" // your domain
const PATH = "/docs/new-relic-solutions/get-started/intro-new-relic/" // path to main page
const CHECK = "Need some inspiration first? Check out this intro video." // text to match on page
const AUTH = USERNAME + PASSWORD
const MAIN_URL = PROTOCOL + AUTH + DOMAIN + PATH

// -------------------- DEPENDENCIES
var assert = require("assert")

// -------------------- CONFIGURATION
await $webDriver.manage().setTimeouts({
implicit: IMPLICIT_TIMEOUT, // sets element load timeout
pageLoad: PAGE_LOAD_TIMEOUT, // sets page load timeout
script: SCRIPT_TIMEOUT // sets script timeout
})

// -------------------- VARIABLES
var By = $selenium.By
var loc = {
video: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > article > div > div > div:nth-child(1) > div > p:nth-child(2)"),
start: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > h1"),
e: [
{ step: 'signup', selector: By.css("#sign-up-for-new-relic-if-you-havent-already") },
{ step: 'ingest', selector: By.css("#ingest-some-data") },
{ step: 'dashboards', selector: By.css("#check-out-some-dashboards") },
{ step: 'data', selector: By.css("#add-more-data") },
{ step: 'alerting', selector: By.css("#set-up-alerting") },
{ step: 'users', selector: By.css("#add-users") }
]
}

// -------------------- FUNCTIONS
// for backwards compatibility with legacy runtimes
async function waitForAndFindElement(locator, timeout) {
const element = await $webDriver.wait(
$selenium.until.elementLocated(locator),
timeout,
"Timed-out waiting for element to be located using: " + locator
)
await $webDriver.wait(
$selenium.until.elementIsVisible(element),
timeout,
"Timed-out waiting for element to be visible using ${element}"
)
return await $webDriver.findElement(locator)
}

// -------------------- START OF SCRIPT
// Start logging
var start_time = new Date()
console.log("Starting synthetics script: " + SCRIPT_NAME)

// confirm timeouts are set
const {implicit, pageLoad, script} = await $webDriver.manage().getTimeouts()
console.log("Timeouts are set to:")
console.log(" IMPLICIT: " + implicit / 1000 + "s")
console.log(" PAGE LOAD: " + pageLoad / 1000 + "s")
console.log(" SCRIPT: " + script / 1000 + "s")

// Setting User Agent is not then-able, so we do this first (if defined and not default)
if (USER_AGENT && 0 !== USER_AGENT.trim().length && USER_AGENT != "default") {
$headers.add("User-Agent", USER_AGENT)
console.log("Setting User-Agent to " + USER_AGENT)
}

// if an error happens at any step, script execution is halted and a failed result is returned
console.log("1. get: " + MAIN_URL)
await $webDriver.get(MAIN_URL)

console.log("2. waitForAndFindElement: " + loc.video)
const textBlock = await waitForAndFindElement(loc.video, IMPLICIT_TIMEOUT)

console.log("3. getText: " + CHECK)
const text = await textBlock.getText()

console.log("4. assert.equal: " + text)
assert.equal(text, CHECK, "validation text not found")

console.log("5. waitForAndFindElement: " + loc.start)
const platformMenu = await waitForAndFindElement(loc.start, IMPLICIT_TIMEOUT)

console.log("6. takeScreenshot")
await $webDriver.takeScreenshot()

console.log("7. findElement")
loc.e.forEach(async function (nr, i) {
let n = i + 1
try{
// verify each asset has loaded
console.log(" " + n + ". " + nr.step + ": " + nr.selector)
await $webDriver.findElement(nr.selector)
}catch(exception){
console.error("Failure in Step 7." + n)
throw exception
}
})

// End logging
var end_time = new Date()

// Calculate the duration
var script_duration = end_time - start_time

// Log the times
console.log("Start time: " + start_time)
console.log("End time: " + end_time)
console.log("Duration: " + script_duration)
```
```js
/**
* Script Name: Best Practices - Chrome 100
* Author: New Relic
* Version: 1.5
* Purpose: best practices example
* Reference: https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/synthetic-scripted-browser-reference-monitor-versions-chrome-100/
*/

// -------------------- CONSTANTS
const SCRIPT_NAME = "Best Practices - Chrome 100" // name to record in script log
const IMPLICIT_TIMEOUT = 3000 // default implicit timeout is 10 seconds, 3 seconds x 8 findElement operations = 24 seconds, assuming all operations time out
const PAGE_LOAD_TIMEOUT = 60000 // default page load timeout is 60 seconds, fail early to prevent long duration timeouts
const SCRIPT_TIMEOUT = 20000 // default script timeout is 30 seconds
const USER_AGENT = "default" // set the user agent for Chrome
const PROTOCOL = "https://" // set the protocol
const USERNAME = "" // username:
const PASSWORD = "" // password@
const DOMAIN = "docs.newrelic.com" // your domain
const PATH = "/docs/new-relic-solutions/get-started/intro-new-relic/" // path to main page
const CHECK = "Need some inspiration first? Check out this intro video." // text to match on page
const AUTH = USERNAME + PASSWORD
const MAIN_URL = PROTOCOL + AUTH + DOMAIN + PATH

// -------------------- DEPENDENCIES
var assert = require("assert")

// -------------------- CONFIGURATION
await $webDriver.manage().setTimeouts({
implicit: IMPLICIT_TIMEOUT, // sets element load timeout
pageLoad: PAGE_LOAD_TIMEOUT, // sets page load timeout
script: SCRIPT_TIMEOUT // sets script timeout
})

// -------------------- VARIABLES
var By = $selenium.By
var loc = {
video: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > article > div > div > div:nth-child(1) > div > p:nth-child(2)"),
start: By.css("#gatsby-focus-wrapper > div.css-1uz5ayg > div > main > div > h1"),
e: [
{ step: 'signup', selector: By.css("#sign-up-for-new-relic-if-you-havent-already") },
{ step: 'ingest', selector: By.css("#ingest-some-data") },
{ step: 'dashboards', selector: By.css("#check-out-some-dashboards") },
{ step: 'data', selector: By.css("#add-more-data") },
{ step: 'alerting', selector: By.css("#set-up-alerting") },
{ step: 'users', selector: By.css("#add-users") }
]
}

// -------------------- FUNCTIONS
// for backwards compatibility with legacy runtimes
async function waitForAndFindElement(locator, timeout) {
const element = await $webDriver.wait(
$selenium.until.elementLocated(locator),
timeout,
"Timed-out waiting for element to be located using: " + locator
)
await $webDriver.wait(
$selenium.until.elementIsVisible(element),
timeout,
"Timed-out waiting for element to be visible using ${element}"
)
return await $webDriver.findElement(locator)
}

// -------------------- START OF SCRIPT
// Start logging
var start_time = new Date()
console.log("Starting synthetics script: " + SCRIPT_NAME)

// confirm timeouts are set
const {implicit, pageLoad, script} = await $webDriver.manage().getTimeouts()
console.log("Timeouts are set to:")
console.log(" IMPLICIT: " + implicit / 1000 + "s")
console.log(" PAGE LOAD: " + pageLoad / 1000 + "s")
console.log(" SCRIPT: " + script / 1000 + "s")

// Setting User Agent is not then-able, so we do this first (if defined and not default)
if (USER_AGENT && 0 !== USER_AGENT.trim().length && USER_AGENT != "default") {
$headers.add("User-Agent", USER_AGENT)
console.log("Setting User-Agent to " + USER_AGENT)
}

// if an error happens at any step, script execution is halted and a failed result is returned
console.log("1. get: " + MAIN_URL)
await $webDriver.get(MAIN_URL)

console.log("2. waitForAndFindElement: " + loc.video)
const textBlock = await waitForAndFindElement(loc.video, IMPLICIT_TIMEOUT)

console.log("3. getText: " + CHECK)
const text = await textBlock.getText()

console.log("4. assert.equal: " + text)
assert.equal(text, CHECK, "validation text not found")

console.log("5. waitForAndFindElement: " + loc.start)
const platformMenu = await waitForAndFindElement(loc.start, IMPLICIT_TIMEOUT)

console.log("6. takeScreenshot")
await $webDriver.takeScreenshot()

console.log("7. findElement")
loc.e.forEach(async function (nr, i) {
let n = i + 1
try{
// verify each asset has loaded
console.log(" " + n + ". " + nr.step + ": " + nr.selector)
await $webDriver.findElement(nr.selector)
}catch(exception){
console.error("Failure in Step 7." + n)
throw exception
}
})

// End logging
var end_time = new Date()

// Calculate the duration
var script_duration = end_time - start_time

// Log the times
console.log("Start time: " + start_time)
console.log("End time: " + end_time)
console.log("Duration: " + script_duration)
```
</Step>
</Steps>
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ Nextcloud ダッシュボードを使用すると、システム内のファイ

`nri-flex-nextcloud.yml`ファイルは次のようになります。

```yml
integrations:
- name: nri-flex
config:
name: nextcloudFlex
global:
base_url: http://<YOUR_HOST_IP>/ocs/v2.php/apps/serverinfo/api/v1/
user: <nextcloud_username>
pass: <nextcloud_password>
apis:
- event_type: EVENT_TYPE
url: info?format=json
```
```yml
integrations:
- name: nri-flex
config:
name: nextcloudFlex
global:
base_url: http://<YOUR_HOST_IP>/ocs/v2.php/apps/serverinfo/api/v1/
user: <nextcloud_username>
pass: <nextcloud_password>
apis:
- event_type: EVENT_TYPE
url: info?format=json
```

Nextcloud のメトリクスは次の URL で入手できます: `http://<YOUR_HOST_IP>/ocs/v2.php/apps/serverinfo/api/v1/info?format=json`

Expand All @@ -68,13 +68,13 @@ Nextcloud ダッシュボードを使用すると、システム内のファイ
1. `logging.yml`という名前のログファイルを作成します `/etc/newrelic-infra/logging.d/`
2. ログ ファイルを作成した後、次のスクリプトを `logging.yml` ファイルに追加します。

```yml
logs:
- name: nextcloud.log
file: /var/www/nextcloud/data/nextcloud.log
attributes:
logtype: nextcloud_log
```
```yml
logs:
- name: nextcloud.log
file: /var/www/nextcloud/data/nextcloud.log
attributes:
logtype: nextcloud_log
```
</Step>

<Step>
Expand All @@ -84,9 +84,9 @@ Nextcloud ダッシュボードを使用すると、システム内のファイ

次のコマンドはほとんどのシステムで動作するはずです:

```shell
sudo systemctl restart newrelic-infra.service
```
```shell
sudo systemctl restart newrelic-infra.service
```
</Step>

<Step>
Expand All @@ -112,15 +112,15 @@ Nextcloud ダッシュボードを使用すると、システム内のファイ

過去 5 分間のアクティブ ユーザー数をチェックする NRQL クエリの例を次に示します。

```sql
FROM NextcloudFlexMetrics SELECT latest(ocs.data.activeUsers.last5minutes)
```
```sql
FROM NextcloudFlexMetrics SELECT latest(ocs.data.activeUsers.last5minutes)
```

過去 24 時間のアクティブ ユーザー数をチェックする NRQL クエリの例を次に示します。

```sql
FROM NextcloudFlexMetrics SELECT latest(ocs.data.activeUsers.last24hours)
```
```sql
FROM NextcloudFlexMetrics SELECT latest(ocs.data.activeUsers.last24hours)
```
</Step>
</Steps>

Expand Down

0 comments on commit 861860e

Please sign in to comment.