Skip to content

Commit a5f8f05

Browse files
authored
Merge pull request #786 from ritza-co/915-expandable
915: add expandable code blocks
2 parents c6d33fe + 1271766 commit a5f8f05

32 files changed

Lines changed: 723 additions & 549 deletions

docs/administration/appliance-manager/setting-up-backup-device42-appliance-manager.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,18 @@ find /device42/backup/directory -type f -mtime +7 -delete
163163

164164
For Windows Servers, the following PowerShell script can be used to delete files older than seven days from the targeted directory:
165165

166-
```
167-
# Delete all Files in C:temp older than 7 day(s)
168-
169-
$Path = "C:device42backups"
170-
$Daysback = "-7"
171-
$CurrentDate = Get-Date
172-
$DatetoDelete = $CurrentDate.AddDays($Daysback)
173-
Get-ChildItem $Path | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
174-
```
166+
<details>
167+
<summary>Click to expand the code block</summary>
168+
```
169+
# Delete all Files in C:temp older than 7 day(s)
170+
171+
$Path = "C:device42backups"
172+
$Daysback = "-7"
173+
$CurrentDate = Get-Date
174+
$DatetoDelete = $CurrentDate.AddDays($Daysback)
175+
Get-ChildItem $Path | Where-Object { $_.LastWriteTime -lt $DatetoDelete } | Remove-Item
176+
```
177+
</details>
175178

176179
## Restore the Backup
177180

docs/administration/custom-key-value-pairs-explained.mdx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,19 @@ Add two form parts to your `POST` or `PUT` request:
150150
| `value` || Numeric ID of the related object (for example, an end user ID). |
151151
| `related_field_value_by_id` || `yes` tells Device42 that `value` contains an ID, not the object name. |
152152

153-
```bash
154-
curl -k -X PUT -u 'admin:adm!nd42' \
155-
-F "name=Customer 101" \
156-
-F "key=end_user_details" \
157-
-F "type=related_field" \
158-
-F "related_field_name=endusers" \
159-
-F "value=6" \
160-
-F "related_field_value_by_id=yes" \
161-
https://<device42>/api/1.0/custom_fields/customer/
162-
```
153+
<details>
154+
<summary>Click to expand the code block</summary>
155+
```bash
156+
curl -k -X PUT -u 'admin:adm!nd42' \
157+
-F "name=Customer 101" \
158+
-F "key=end_user_details" \
159+
-F "type=related_field" \
160+
-F "related_field_name=endusers" \
161+
-F "value=6" \
162+
-F "related_field_value_by_id=yes" \
163+
https://<device42>/api/1.0/custom_fields/customer/
164+
```
165+
</details>
163166

164167
The call above sets **End User Details** to the end user whose object ID is **6**.
165168

docs/auto-discovery/agent-based-offline-discovery.mdx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,24 +92,31 @@ It’s important to have a unique file name as you might want to run the discove
9292
Variables are used to define the file name. We use the computer name and the date-time stamp to generate the unique file names for the discovered data.
9393

9494
**Windows example:**
95-
```
96-
C:\>set var=%computername%-%date%-%time::=%
97-
C:\>set var=%var:.=%
98-
C:\>set var=%var:/=-%
99-
C:\>set var=%var: =%
100-
C:\>echo %var%.log
101-
ASUS-GL553V-Thu03-14-2019-16265819.log
102-
C:\>d42_winagent_x64.exe -offline > %var%.log
103-
```
95+
<details>
96+
<summary>Click to expand the code block</summary>
97+
```
98+
C:\>set var=%computername%-%date%-%time::=%
99+
C:\>set var=%var:.=%
100+
C:\>set var=%var:/=-%
101+
C:\>set var=%var: =%
102+
C:\>echo %var%.log
103+
ASUS-GL553V-Thu03-14-2019-16265819.log
104+
C:\>d42_winagent_x64.exe -offline > %var%.log
105+
```
106+
</details>
104107

105108
**Linux example:**
106-
```
107-
$ VAR1=`hostname`-`date +%Y%m%d-%k%M%S`
108-
$
109-
$ echo $VAR1
110-
> CentOS7-20190306-133710.log
111-
$ ./linuxagent.sh -offline > $VAR1.log
112-
```
109+
110+
<details>
111+
<summary>Click to expand the code block</summary>
112+
```
113+
$ VAR1=`hostname`-`date +%Y%m%d-%k%M%S`
114+
$
115+
$ echo $VAR1
116+
> CentOS7-20190306-133710.log
117+
$ ./linuxagent.sh -offline > $VAR1.log
118+
```
119+
</details>
113120

114121
### Linux Prerequisite: Sudo Permissions
115122

docs/auto-discovery/d42-ping-sweep.mdx

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,26 @@ Use the `ping.cfg.sample` file to select your settings. Make a copy of this fi
105105

106106
Below is a sample of the `ping.cfg` file:
107107

108-
```ini
109-
[settings]
110-
# base_url points to your Device42 server
111-
# For example: base_url = https://192.168.1.50
112-
base_url = https://192.168.1.100
113-
# Device42 username and password
114-
username = username
115-
secret = password
116-
117-
[targets]
118-
# targets can be specified as:
119-
# single: 192.168.1.125
120-
# range: 192.168.1.101-192.168.1.150
121-
# cidr block: 192.168.1.0/24
122-
# any combination of above: 192.168.3.0/24,192.168.4.1-192.168.4.10,192.168.55.22,10.0.0.0/24
123-
targets = 192.168.1.1/24
124-
```
108+
<details>
109+
<summary>Click to expand the code block</summary>
110+
```ini
111+
[settings]
112+
# base_url points to your Device42 server
113+
# For example: base_url = https://192.168.1.50
114+
base_url = https://192.168.1.100
115+
# Device42 username and password
116+
username = username
117+
secret = password
118+
119+
[targets]
120+
# targets can be specified as:
121+
# single: 192.168.1.125
122+
# range: 192.168.1.101-192.168.1.150
123+
# cidr block: 192.168.1.0/24
124+
# any combination of above: 192.168.3.0/24,192.168.4.1-192.168.4.10,192.168.55.22,10.0.0.0/24
125+
targets = 192.168.1.1/24
126+
```
127+
</details>
125128

126129
1. In the **`[settings]`** section, enter the base URL (FQDN or IP) for the Device42 appliance on your network, including credentials. Make sure the credentials have the required access permissions. The minimum required for the user are:
127130
- Ping Sweep | Can add Ping Sweep

docs/auto-discovery/netflow-collector.mdx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,23 @@ This will start the listener on port 2055 (unless a different port is specified)
8181

8282
The following options are available to augment the behavior of `d42-netflow-collector-windows-v100.exe`:
8383

84-
```
85-
-addr string | netflow listen address (default "0.0.0.0:2055")
86-
-debug | show netflow info
87-
-h string | D42 hostname
88-
-i int | interval in seconds between sends data to D42 (default 300)
89-
-ignore-ip string | ignore IPs
90-
-ignore-port string | ignore ports
91-
-live-entries | display live entries
92-
-live-entries-nok | display OK live entries
93-
-live-entries-ok | display NOK live entries
94-
-p string | D42 password
95-
-print-data | prints data
96-
-u string | D42 username
97-
```
84+
<details>
85+
<summary>Click to expand the code block</summary>
86+
```
87+
-addr string | netflow listen address (default "0.0.0.0:2055")
88+
-debug | show netflow info
89+
-h string | D42 hostname
90+
-i int | interval in seconds between sends data to D42 (default 300)
91+
-ignore-ip string | ignore IPs
92+
-ignore-port string | ignore ports
93+
-live-entries | display live entries
94+
-live-entries-nok | display OK live entries
95+
-live-entries-ok | display NOK live entries
96+
-p string | D42 password
97+
-print-data | prints data
98+
-u string | D42 username
99+
```
100+
</details>
98101

99102
The NetFlow collector will capture and send data to Device42 in 5-minute increments by default. You may customize this interval using the `-i` command switch.
100103

docs/getstarted/installation/installing-the-d42-netflow-collector-as-a-service.mdx

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,26 @@ After executing the above command, you'll see your new service in the services c
7171

7272
Create a file `/etc/systemd/system/netflow.service` containing the following:
7373

74-
```
75-
## systemd
74+
<details>
75+
<summary>Click to expand the code block</summary>
76+
```
77+
## systemd
7678

77-
[Unit]
78-
Description=NetFlow Service
79+
[Unit]
80+
Description=NetFlow Service
7981

80-
[Service]
81-
PIDFile=/tmp/netflow.pid
82-
User=root
83-
Group=root
84-
WorkingDirectory=/opt/rc/services
85-
ExecStart=/opt/rc/services/netflow -h https://ma.host.domain -u username -p password -i 30
86-
Restart=always
82+
[Service]
83+
PIDFile=/tmp/netflow.pid
84+
User=root
85+
Group=root
86+
WorkingDirectory=/opt/rc/services
87+
ExecStart=/opt/rc/services/netflow -h https://ma.host.domain -u username -p password -i 30
88+
Restart=always
8789

88-
[Install]
89-
WantedBy=multi-user.target
90-
```
90+
[Install]
91+
WantedBy=multi-user.target
92+
```
93+
</details>
9194

9295
### Start the Service
9396

docs/getstarted/installation/windows-discovery-service-installation.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,18 @@ Both the MA and the RC ship with a self-signed certificate, making it necessary
6868

6969
Install a valid certificate on the MA and the RC. You can then change the default behavior of the WDS to no longer ignore SSL errors by editing the WDS runtime configuration file:
7070

71-
```
72-
<configuration>
73-
<appSettings>
74-
....
75-
<add key="IgnoreSSLErrors" value="false"/>
76-
....
77-
</appSettings>
78-
...
79-
```
71+
<details>
72+
<summary>Click to expand the code block</summary>
73+
```markup
74+
<configuration>
75+
<appSettings>
76+
....
77+
<add key="IgnoreSSLErrors" value="false"/>
78+
....
79+
</appSettings>
80+
...
81+
```
82+
</details>
8083

8184
## Create a New WMI Autodiscovery Job
8285

docs/getstarted/installation/windows-service-installation.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,17 @@ There are multiple ways to install and start the service. For your convenience,
4242

4343
For example:
4444

45-
```json
45+
<details>
46+
<summary>Click to expand the code block</summary>
47+
```js
4648
{
4749
"executablePath": "c:\\Program Files\\Device42\\d42_winagent.exe",
4850
"WorkingDir": "c:\\ProgramData\\Device42",
4951
"arguments": ["-host=https://10.92.11.63","-skip-software=true"],
5052
"interval": 2
5153
}
5254
```
55+
</details>
5356

5457
:::note
5558
Each of the `"arguments"` is enclosed in double quotes.

docs/getstarted/tutorials/tutorial-loading-data-using-the-api.mdx

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,24 @@ You can view data added for an object category by navigating to the relevant lis
5353

5454
Now, let's look at one of the curl statements you just executed. If you are sure that you will never use curl and the Device42 API, you can safely skip this section.
5555

56-
Each line in the script has a curl statement like the one below. Note that the backslashes (`\`) aren't in the original script; they are used here to continue the command on a new line for readability.
57-
58-
```bash
59-
#Add a Building
60-
curl -i -H "Accept: application/json" \
61-
-X POST \
62-
-d "name=New Haven DC" \
63-
-d "address=123 main st" \
64-
-d "contact_name=roger" \
65-
-d "contact_phone=1234567890" \
66-
-d "notes=super critical" \
67-
-u $USER:$PASS \
68-
$URL/api/1.0/buildings/ \
69-
--insecure
70-
```
56+
Each line in the script has a curl statement like the one below.
57+
58+
<details>
59+
<summary>Click to expand the code block</summary>
60+
```bash
61+
#Add a Building
62+
curl -i -H "Accept: application/json" \
63+
-X POST \
64+
-d "name=New Haven DC" \
65+
-d "address=123 main st" \
66+
-d "contact_name=roger" \
67+
-d "contact_phone=1234567890" \
68+
-d "notes=super critical" \
69+
-u $USER:$PASS \
70+
$URL/api/1.0/buildings/ \
71+
--insecure
72+
```
73+
</details>
7174

7275
The `-i`, `-H`, and `--insecure` parameters should be in all Device42 API calls:
7376

docs/integration/external-integrations/device42-hp-service-manager-integration.mdx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,25 @@ Integrating Device42 data to HPSM is easily accomplished using the Device42-hpsm
3131
2. Copy (or move/rename) the settings file conf.sample to conf
3232
3. Edit the conf file you created in the last step to contain your Device42 & HPSM instance credentials \[host, user, pass\]:
3333

34-
```
35-
#========= Device 42 ========= #
36-
d42_host = '192.168.1.102'
37-
d42_username = 'user'
38-
d42_password = 'pass'
39-
#========= HPSM ========= #
40-
hpsm_host = '10.42.42.46'
41-
hpsm_protocol = 'http'
42-
hpsm_port = '13080'
43-
hpsm_username = 'user'
44-
hpsm_password = 'pass'
45-
hpsm_api_version = '9'
46-
#========= Options ========= #
47-
opt_debug = True
48-
opt_dry_run = True
49-
```
34+
<details>
35+
<summary>Click to expand the code block</summary>
36+
```
37+
#========= Device 42 ========= #
38+
d42_host = '192.168.1.102'
39+
d42_username = 'user'
40+
d42_password = 'pass'
41+
#========= HPSM ========= #
42+
hpsm_host = '10.42.42.46'
43+
hpsm_protocol = 'http'
44+
hpsm_port = '13080'
45+
hpsm_username = 'user'
46+
hpsm_password = 'pass'
47+
hpsm_api_version = '9'
48+
#========= Options ========= #
49+
opt_debug = True
50+
opt_dry_run = True
51+
```
52+
</details>
5053

5154
1. Configure HPSM: Open the Database Dictionary and add field (type ‘number’, name ‘device42.id’) to both the models ‘computer’ and ‘networkcomponents' ![Configure HPSM Database Dictionary](/assets/images/2015-03-15-hpsm-conf-1.png) ![Configure HPSM Databse Dictionary fields](/assets/images/2015-03-15-hpsm-conf-2.png)
5255
2. Operator should have access to the REST API: ![Configure Operator API Access](/assets/images/2015-03-15-hpsm-3.png)

0 commit comments

Comments
 (0)