Skip to content

Commit

Permalink
Issue #57: All the storage examples are incorrect with type=linux
Browse files Browse the repository at this point in the history
* Fixed `ConnectorPageProducer` to detect right device types.
* Renamed `selectedConnectors` to `connectors` in the YAML examples.
  • Loading branch information
NassimBtk committed Sep 25, 2024
1 parent cdc2730 commit b338d5c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ connector:
- remote
- local
appliesTo:
- Storage
- NT
supersedes:
- WBEMGenDiskNT
Expand Down
13 changes: 11 additions & 2 deletions src/it/metricshub-connectors/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ assert htmlText.indexOf("Technology and protocols:") > - 1 : "MIB2 'Technology a
assert htmlText.indexOf("SNMP") > - 1 : "MIB2 SNMP protocol must be present"
assert htmlText.indexOf('<h3 id="examples">Examples</h3>') > - 1 : "MIB2: Page must indicate 'Examples' as HTML H3 element"
assert htmlText.indexOf('<h4 id="cli">CLI</h4>') > - 1 : "MIB2: Page must indicate 'CLI' as HTML H4 element"
assert htmlText.indexOf("metricshub HOSTNAME -t management -c +MIB2 --snmp v2c --community public") > - 1 : "MIB2: Page must indicate the expected CLI example"
assert htmlText.indexOf("metricshub HOSTNAME -t network -c +MIB2 --snmp v2c --community public") > - 1 : "MIB2: Page must indicate the expected CLI example"
assert htmlText.indexOf('<h4 id="metricshub-yaml">metricshub.yaml</h4>') > - 1 : "MIB2: Page must indicate 'metricshub.yaml' as HTML H4 element"
assert htmlText.indexOf("snmp:") > - 1 : "MIB2: 'snmp:' yaml section must be present"
assert htmlText.indexOf("v2c") > - 1 : "MIB2: version 'v2c' must be present in the yaml configuration example"
Expand Down Expand Up @@ -247,4 +247,13 @@ assert htmlText.indexOf("Any system with Nvidia GPUs") > -1 : "NvidiaSmi: Unexpe
assert htmlText.indexOf("Microsoft Windows, Linux") > -1 : "NvidiaSmi: Unexpected Operating Systems"
assert htmlText.indexOf("NVIDIA drivers with NVIDIA-SMI support") > -1 : "NvidiaSmi: Unexpected Leverages"
assert htmlText.indexOf("Command Lines") > -1 : "NvidiaSmi: Unexpected Technology and protocols"
assert htmlText.indexOf("<code>nvidia-smi</code>") > -1 : "NvidiaSmi: Unexpected criterion command line"
assert htmlText.indexOf("<code>nvidia-smi</code>") > -1 : "NvidiaSmi: Unexpected criterion command line"

// WinStoreSpaces
htmlText = new File(basedir, "target/site/connectors/winstoragespaces.html").text
assert htmlText.indexOf("Any system") > -1 : "WinStoreSpaces: Unexpected Typical platform"
assert htmlText.indexOf("Storage System, Microsoft Windows") > -1 : "WinStoreSpaces: Unexpected Operating Systems"
assert htmlText.indexOf("Windows Storage Spaces") > -1 : "WinStoreSpaces: Unexpected Leverages"
assert htmlText.indexOf("WMI/WinRM") > -1 : "WinStoreSpaces: Unexpected Technology and protocols"
assert htmlText.indexOf("<code>root\\Microsoft\\Windows\\Storage</code>") > -1 : "WinStoreSpaces: Unexpected namespaces"
assert htmlText.indexOf("metricshub HOSTNAME -t storage -c +WinStorageSpaces --wmi -u USER") > -1 : "WinStoreSpaces: Page must indicate the expected CLI example."
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void produce(
sink.section2_();

// MetricsHub Example
produceMetricsHubExamplesContent(sink, osList, technologies, sudoCommands);
produceMetricsHubExamplesContent(sink, appliesTo, technologies, sudoCommands);

// Detection criteria
sink.section2();
Expand Down Expand Up @@ -407,7 +407,7 @@ private void produceMetricsHubExamplesContent(
yamlBuilder.append(" host.name: <HOSTNAME> # Change with actual host name\n");
yamlBuilder.append(" host.type: ").append(hostType).append("\n");
yamlBuilder
.append(" selectConnectors: [ ")
.append(" connectors: [ +")
.append(connectorId)
.append(" ] # Optional, to load only this connector\n")
.append(PROTOCOLS_SECTION);
Expand Down

0 comments on commit b338d5c

Please sign in to comment.