Skip to content

Commit 6a00a3c

Browse files
Merge pull request #7 from Charles1000Chen/mu
Merge cumulated updates
2 parents 9bc7bdc + fa1f27f commit 6a00a3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2978
-552
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
/spectrum-virtualize-exporter
22
/temp.yaml
3-
/.vscode
3+
4+
/.vscode
5+
/.whitesource
6+
/.jenkinsfile*

.travis.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
language: go
22

33
go:
4-
- 1.x
5-
- 1.11.x
6-
- master
4+
- 1.22.x

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## 0.9.4 / 2022-04-18
2+
3+
* [FIXBUG] Fix vulunerabilities for CVE-2022-21698
4+
5+
## 0.9.3 / 2021-06-21
6+
7+
* [FEATURE] Support to verify the certification of Spectrum device
8+
* [CHANGE] Add a parameter 'verifyCert' into spectrumVirtualize.yml file to turn on/off the ability of certification verification
9+
110
## 0.9.2 / 2020-04-30
211

312
* [CHANGE] Disable metrics from the exporter itself by default

Dockerfile

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1+
FROM ubuntu:jammy AS pem
2+
RUN apt update && apt install curl -y
3+
WORKDIR /root/
4+
# The links of the IBM root CA and intermediate certs are from https://daymvs1.pok.ibm.com/ibmca/certificates.do;
5+
# for other well known CAs, just install the ca-certificates package.
6+
RUN curl https://daymvs1.pok.ibm.com/ibmca/downloadCarootCert.do?file=carootcert.der --output carootcert.der --cipher 'DEFAULT:!DH' && \
7+
curl https://daymvs1.pok.ibm.com/ibmca/downloadCarootCert.do?file=caintermediatecert.der --output caintermediatecert.der --cipher 'DEFAULT:!DH' && \
8+
openssl x509 -inform der -in carootcert.der -out 01-carootcert.pem && \
9+
openssl x509 -inform der -in caintermediatecert.der -out 02-caintermediatecert.pem
110

2-
# FROM quay.io/prometheus/busybox:latest
3-
FROM s390x/busybox:latest
4-
COPY spectrum-virtualize-exporter /bin/spectrum-virtualize-exporter
5-
COPY spectrumVirtualize.yml /etc/spectrumVirtualize/spectrumVirtualize.yml
11+
12+
FROM ubuntu:jammy
13+
14+
ARG APP_USER=spectrum
15+
16+
# Use "make binary" to build the binary spectrum-virtualize-exporter
17+
COPY spectrum-virtualize-exporter /opt/spectrumVirtualize/spectrum-virtualize-exporter
18+
COPY spectrumVirtualize.yml /opt/spectrumVirtualize/spectrumVirtualize.yml
19+
COPY --from=pem /root/*.pem /usr/local/share/ca-certificates/
20+
# https://github.com/golang/go/blob/master/src/crypto/x509/root_linux.go
21+
RUN mkdir -p /etc/ssl/certs \
22+
&& cat /usr/local/share/ca-certificates/*.pem >> /etc/ssl/certs/ca-certificates.crt \
23+
&& groupadd -g 1000 -r $APP_USER \
24+
&& useradd -u 1000 -r -g $APP_USER -d /home/$APP_USER -m -s /bin/bash $APP_USER \
25+
&& chown -R 1000:1000 /opt/spectrumVirtualize
26+
27+
USER $APP_USER
628
EXPOSE 9119
7-
ENTRYPOINT ["/bin/spectrum-virtualize-exporter"]
8-
CMD ["--config.file=/etc/spectrumVirtualize/spectrumVirtualize.yml"]
29+
ENTRYPOINT ["/opt/spectrumVirtualize/spectrum-virtualize-exporter"]
30+
CMD ["--config.file=/etc/spectrumVirtualize/spectrumVirtualize.yml"]

Makefile

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,23 @@
1-
go build
1+
SHELL := /bin/bash -o pipefail
2+
PROJDIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
3+
PROJNAME := $(shell basename $(PROJDIR))
4+
VERSION := $(shell git describe --abbrev=0 --tags)
5+
6+
versionDir=github.com/prometheus/common/version
7+
gitBranch=$(shell git rev-parse --abbrev-ref HEAD)
8+
gitCommit=$(shell git rev-parse --short HEAD)
9+
gitUser=$(shell git config user.name | tr -d ' ')
10+
buildDate=$(shell TZ=Asia/Shanghai date +%FT%T%z)
11+
12+
ldflags="-s -w -X ${versionDir}.Version=${VERSION} -X ${versionDir}.Revision=${gitCommit} \
13+
-X ${versionDir}.Branch=${gitBranch} -X ${versionDir}.BuildUser=${gitUser} \
14+
-X ${versionDir}.BuildDate=${buildDate}"
15+
all: binary
16+
17+
binary:
18+
@echo "build the ${PROJNAME}"
19+
go build -ldflags ${ldflags}
20+
@echo "build done."
21+
22+
docker: binary
23+
docker build . -t $(PROJNAME):$(gitCommit)

README.md

Lines changed: 73 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ collects metrics from storage solutions which are built with the
66
Storage solutions built with the IBM Spectrum Virtualize software are the
77
[IBM FlashSystem V9000 system](https://www.ibm.com/support/knowledgecenter/STKMQV_8.2.1/com.ibm.storage.vflashsystem9000.8.2.1.doc/svc_svcovr_1bcfiq.html),
88
the [IBM SAN Volume Controller](https://www.ibm.com/us-en/marketplace/san-volume-controller) and
9-
the [IBM Storwize Family](https://www.ibm.com/it-infrastructure/storage/storwize<Paste>)
9+
the [IBM Storwize Family](https://www.ibm.com/it-infrastructure/storage/storwize\<Paste>)
1010

1111
## Usage
1212

13-
| Flag | Description | Default Value |
13+
| Flag | Description | Default Value |
1414
| --- | --- | --- |
1515
| config.file | Path to configuration file | spectrumVirtualize.yml |
16-
| web.telemetry-path | Path under which to expose metrics | /metrics |
16+
| web.metrics-context | Context under which to expose metrics | /metrics |
17+
| web.settings-context | Context under which to expose setting metrics | /settings |
1718
| web.listen-address | Address on which to expose metrics and web interface | :9119 |
1819
| web.disable-exporter-metrics | Exclude metrics about the exporter itself (promhttp_*, process_*, go_*) | true |
19-
| --collector.name | Collector are enabled, the name means name of CLI Command | By default enabled collectors: lssystem and lssystemstats. |
20-
| --no-collector.name | Collectors that are enabled by default can be disabled, the name means name of CLI Command | By default disabled collectors: lsnodestats, lsmdisk, lsmdiskgrp, lsvdisk and lsvdiskcopy. |
20+
| --collector.[name] | Enable or disable collector. The [name] is in the list "`lsmdisk`, `lsmdiskgrp`, `lsnodestats`, `lssystem`, `lssystemstats`, `lsvdisk`, `lsvdiskcopy`, `lscloudcallhome`, `lsdrive`, `lsenclosure`, `lsenclosurebattery`, `lsenclosurecanister`, `lsenclosurepsu`, `lshost`, `ip`, `lsmdisk_s`, `lsmdiskgrp_s`, `lsnodecanister`, `lsportfc`" | [true\|false]. <br> By default enabled collectors: `lssystem`, `lssystemstats`, `lscloudcallhome`, `lsdrive`, `lsenclosure`, `lsenclosurebattery`, `lsenclosurecanister`, `lsenclosurepsu`, `lshost`, `ip`, `lsmdisk_s`, `lsmdiskgrp_s`, `lsnodecanister`, `lsportfc`. |
2121

2222
## Building and running
2323

@@ -27,47 +27,81 @@ the [IBM SAN Volume Controller](https://www.ibm.com/us-en/marketplace/san-volume
2727
* Building:
2828

2929
* binary
30-
```
30+
31+
```bash
3132
export GOPATH=your_gopath
3233
cd your_gopath
33-
git clone git@github.ibm.com:ZaaS/spectrum-virtualize-exporter.git
34+
git clone https://github.com/IBM/spectrum-virtualize-exporter.git
3435
cd spectrum-virtualize-exporter
35-
go build
36+
make binary
3637
go install (Optional but recommended. This step will copy spectrum-virtualize-exporter binary package into $GOPATH/bin directory. It will be connvenient to copy the package to Monitoring docker image)
3738
```
39+
3840
* docker image
39-
```
40-
docker build -t spectrum-virtualize-exporter .
41+
42+
```bash
43+
make docker
4144
```
4245

4346
* Running:
4447
* Run Locally
45-
```
48+
49+
```bash
4650
./spectrum-virtualize-exporter --config.file=/etc/spectrumVirtualize/spectrumVirtualize.yml
4751
```
4852

4953
* Run as docker image
50-
```
51-
docker run -it -d -p 9119:9119 -v /etc/spectrumVirtualize/spectrumVirtualize.yml:/etc/spectrumVirtualize/spectrumVirtualize.yml --name spectrum-virtualize-exporter spectrum-virtualize-exporter --config.file=/etc/spectrumVirtualize/spectrumVirtualize.yml --log.level debug --restart always
54+
55+
```bash
56+
docker run -it -d -p 9119:9119 -v /etc/spectrumVirtualize/spectrumVirtualize.yml:/etc/spectrumVirtualize/spectrumVirtualize.yml --name spectrum-virtualize-exporter spectrum-virtualize-exporter --config.file=/etc/spectrumVirtualize/spectrumVirtualize.yml --log.level debug
5257
```
5358

54-
* Visit http://localhost:9119/metrics
59+
* Visit <http://localhost:9119/metrics>
5560

5661
## Configuration
5762

58-
The spectrum-virtualize-exporter reads from [spectrumVirtualize.yml](spectrumVirtualize.yml) config file by default. Edit your config YAML file, Enter the IP address of the storage device, your username, and your password there.
59-
```
63+
The spectrum-virtualize-exporter loads the [./spectrumVirtualize.yml](spectrumVirtualize.yml) config file by default.
64+
65+
### Required settings
66+
67+
* `targets.[].ipAddress`: IP address of the storage device.
68+
* `targets.[].userid`: Username to access the storage device.
69+
* `targets.[].password`: User password to access the storage device.
70+
71+
### Optionally settings
72+
73+
* `extra_labels.[].name`: Customized label name adding to metrics.
74+
* `extra_labels.[].value`: Value of the customized label.
75+
* `tls_server_config.ca_cert`: The CA certificate chain file in pem format for verifying client certificate.
76+
* `tls_server_config.server_cert`: The server's certificate chain file in pem format.
77+
* `tls_server_config.server_key`: The server's private key file.
78+
79+
### Config File Sample
80+
81+
```yaml
6082
targets:
6183
- ipAddress: IP address
6284
userid: user
6385
password: password
86+
extra_labels:
87+
- name: pod_name
88+
value: pod_value
89+
tls_server_config:
90+
ca_cert: ./certs/ca-root.crt
91+
server_cert: ./certs/server.crt
92+
server_key: ./certs/server.key
6493
```
6594

95+
**If any of the "ca_cert", "server_cert" or "server_key" are not provided, the exporter http server will start without https(mTLS) enabled.**
96+
6697
## Exported Metrics
6798

68-
| CLI Command | Description | Default | Metrics | Total number of metrics |
99+
* It recommended to scrape every 30 seconds.
100+
101+
| RESTful API | Description | Default | Metrics | Total number of metrics |
69102
| --- | --- | --- | --- | --- |
70-
| - | Metrics from the exporter itself. | Disabled | [List](docs/exporter_metrics.md) | 35 |
103+
| - | Metrics from the prometheus exporter itself. | Disabled | [List](docs/exporter_prometheus_metrics.md) | 30 |
104+
| - | Metrics from the spectrum exporter itself. | Enabled | [List](docs/exporter_spectrum_metrics.md) | 4 |
71105
| lssystem | Get a detailed view of a clustered system (system). | Enabled | [List](docs/lssystem_metrics.md) | 57 |
72106
| lssystemstats | Get the most recent values of all node statistics in a system. | Enabled | [List](docs/lssystemstats_metrics.md) | 49 |
73107
| lsnodestats | Ge the most recent values of statistics for all nodes. | Disabled | [List](docs/lsnodestats_metrics.md)| 46 |
@@ -76,6 +110,27 @@ targets:
76110
| lsvdisk | Get detailed view of volumes that are recognized by the system. | Disabled | [List](docs/lsvdisk_metrics.md) | 1 |
77111
| lsvdiskcopy | Get volume copy information. | Disabled | [List](docs/lsvdiskcopy_metrics.md) | 1 |
78112

113+
## Exported Setting Metrics
114+
115+
* It recommended to scrape every >15 minutes.
116+
117+
| RESTful API | Description | Default | Metrics | Total number of metrics |
118+
| --- | --- | --- | --- | --- |
119+
| - | Metrics from the prometheus exporter itself. | Disabled | [List](docs/exporter_prometheus_metrics.md) | 30 |
120+
| - | Metrics from the spectrum exporter itself. | Enabled | [List](docs/exporter_spectrum_metrics.md) | 4 |
121+
| lscloudcallhome | The status of the Call Home information. | Enabled | [List](docs/lscloudcallhome_settings.md) | 1 |
122+
| lsenclosure | The summary of the enclosures including canister and PSU. | Enabled | [List](docs/lsenclosure_settings.md) | 1 |
123+
| lsenclosurebattery | The information about the batteries. | Enabled | [List](docs/lsenclosurebattery_settings.md) | 2 |
124+
| lsenclosurecanister | The detailed status of each canister in enclosures. | Enabled | [List](docs/lsenclosurecanister_settings.md) | 1 |
125+
| lsenclosurepsu | The information about each power-supply unit (PSU) in enclosures. | Enabled | [List](docs/lsenclosurepsu_settings.md) | 1 |
126+
| lsdrive | The configuration information and drive vital product data (VPD). | Enabled | [List](docs/lsdrive_settings.md) | 3 |
127+
| lshost | The concise information about all the hosts visible to the system. | Enabled | [List](docs/lshost_settings.md) | 1 |
128+
| lsnodecanister | The node canisters that are part of the system. | Enabled | [List](docs/lsnodecanister_settings.md) | 1 |
129+
| lsportfc | The status and properties of the Fibre Channel (FC) input/output (I/O) ports for the clustered system. | Enabled | [List](docs/lsportfc_settings.md) | 1 |
130+
| lsmdisk | The info of managed disks (MDisks) visible to the system. | Enabled | [List](docs/lsmdisk_settings.md) | 1 |
131+
| lsmdiskgrp | The info of storage pools that are visible to the system. | Enabled | [List](docs/lsmdiskgrp_settings.md) | 1 |
132+
| - | The connection status of system IPs(PSYS, SSYS, SVC1, SVC2). | Enabled | [List](docs/lsenclosurebattery_settings.md) | 1 |
133+
79134
## References
80135

81136
* [IBM Spectrum Virtualize RESTful API For FS9xxx](https://www.ibm.com/support/knowledgecenter/en/STSLR9_8.2.0/com.ibm.fs9100_820.doc/rest_api_overview.html)

0 commit comments

Comments
 (0)