IBM Cloud:  IBM Cloud Monitoring with Sysdigの構成確認

# 1. IBM Cloud Consoleを使ったAccess Keyの確認
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/402462c6-0913-4b88-e821-42fa430d50ab.png)


# 2. Sysdig UIを使ったAccess Keyの確認

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/c10794fc-3b84-496a-6ad6-14e5e4c9ef2c.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/62127/8a1864f7-efeb-8bc9-ed36-fe1f23b98e3c.png)


# 3. Sysdig Agentの構成

```txt:version確認
root@z-syasuda:~# /opt/draios/bin/dragent --version
12.13.0
```

Sysdig Agentのreleae notesは[こちら](https://docs.sysdig.com/en/docs/release-notes/sysdig-agent-release-notes)

```txt:config確認
root@z-syasuda:~# cat /opt/draios/etc/dragent.yaml
customerid: c63e9a9a-xxxx-xxxx-xxxx-xxxxxxxxxxxx(この値はAccess Key)
collector: ingest.private.jp-tok.monitoring.cloud.ibm.com
collector_port: 6443
ssl: true
sysdig_capture_enabled: false
sysdig_capture_enabled: false
```

```txt:ステータス確認
root@z-syasuda:~# systemctl status dragent
● dragent.service - LSB: Example initscript
     Loaded: loaded (/etc/init.d/dragent; generated)
     Active: active (running) since Mon 2023-04-03 01:11:24 UTC; 22h ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1007793 ExecStart=/etc/init.d/dragent start (code=exited, status=0/SUCCESS)
      Tasks: 41 (limit: 4778)
     Memory: 146.3M
     CGroup: /system.slice/dragent.service
             ├─1007816 /opt/draios/bin/dragent --daemon --dragentpid=/var/run/dragent.pid
             ├─1007819 /opt/draios/bin/dragent --daemon --dragentpid=/var/run/dragent.pid
             ├─1007820 statsite -f /opt/draios/etc/statsite.ini
             ├─1007821 /opt/draios/bin/dragent --daemon --dragentpid=/var/run/dragent.pid
             ├─1007822 /usr/bin/python3.8 /opt/draios/bin/sdchecks run
             ├─1007823 /opt/draios/bin/dragent --daemon --dragentpid=/var/run/dragent.pid
             ├─1007824 cointerface --log_file /opt/draios/logs/k8s_klog.log --log_file_max_size 10 -v 0 --feature-gates K8sCommand=true
             └─1007825 promscrape_v2 --grpc.address=unix:/opt/draios/run/promscrape.sock --web.enable --web.listen-address=127.0.0.1:9990 --log.format=json --log.level=info --config.file=/opt/draios/etc/promscrape.yaml --source.label=pod_id>

Apr 03 01:11:24 z-syasuda systemd[1]: dragent.service: Succeeded.
Apr 03 01:11:24 z-syasuda systemd[1]: Stopped LSB: Example initscript.
Apr 03 01:11:24 z-syasuda systemd[1]: Starting LSB: Example initscript...
Apr 03 01:11:24 z-syasuda systemd[1]: Started LSB: Example initscript.
Apr 03 01:11:24 z-syasuda statsite[1007820]: Starting statsite.
Apr 03 01:11:24 z-syasuda statsite[1007820]: Listening on stdin.
Apr 03 01:11:24 z-syasuda statsite[1007820]: Listening on tcp '127.0.0.1:8125'
Apr 03 01:11:24 z-syasuda statsite[1007820]: Listening on udp '127.0.0.1:8125'
```

# ROKS(Red Hat OpenShift on IBM Cloud)の場合


```txt:pluginの導入
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud plugin install observe-service
```
```txt:ROKS Clusterに紐づいているIBM Cloud Monitoring with Sysdigの特定
[root@new-syasuda-tok1-vpc1 ~]# ibmcloud ob monitoring config list --cluster c3j463dt0o165mnm7be0
Listing configurations...

OK

Instance name:      IBM Cloud Monitoring-7g
Instance ID:        7fdc5605-d6a4-4734-91b2-5033e7908a97
CRN:                crn:v1:bluemix:public:sysdig-monitor:jp-tok:a/039dbe6794084c7cb514a276dd2345da:7fdc5605-d6a4-4734-91b2-5033e7908a97::
Agent Namespace:    ibm-observe
Private Endpoint:   true
Discovered Agent:   false
```
```txt:Sysdig Agentのバージョン確認
[root@new-syasuda-tok1-vpc1 ~]# oc get pods -n ibm-observe
NAME                 READY   STATUS    RESTARTS   AGE
logdna-agent-npgs5   1/1     Running   0          17h
logdna-agent-sc54l   1/1     Running   0          17h
sysdig-agent-pvlgm   1/1     Running   0          17h
sysdig-agent-z8gzg   1/1     Running   0          17h

[root@new-syasuda-tok1-vpc1 ~]# oc get pods sysdig-agent-pvlgm -n ibm-observe -o yaml|grep imageID
    imageID: icr.io/ext/sysdig/agent@sha256:a0d287ac9f7deb51dc2f1e75b4731aedf91b755695cc73a4c5c77b6959fc27e8

[root@new-syasuda-tok1-vpc1 ~]# ibmcloud cr images --restrict ext/sysdig/agent --no-trunc | grep "sha256:a0d287ac9f7deb51dc2f1e75b4731aedf91b755695cc73a4c5c77b6959fc27e8"
icr.io/ext/sysdig/agent   12.13.0    sha256:a0d287ac9f7deb51dc2f1e75b4731aedf91b755695cc73a4c5c77b6959fc27e8   ext         1 week ago      669 MB   -
icr.io/ext/sysdig/agent   latest     sha256:a0d287ac9f7deb51dc2f1e75b4731aedf91b755695cc73a4c5c77b6959fc27e8   ext         1 week ago      669 MB   -
```

Sysdig Agentのreleae notesは[こちら](https://docs.sysdig.com/en/docs/release-notes/sysdig-agent-release-notes)

```txt:configmap（設定情報が含まれている）
[root@new-syasuda-tok1-vpc1 ~]# oc get secrets sysdig-agent -n ibm-observe -o yaml
apiVersion: v1
data:
  access-key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
kind: Secret
metadata:
  creationTimestamp: "2022-10-06T07:18:35Z"
  name: sysdig-agent
  namespace: ibm-observe
  resourceVersion: "198845846"
  uid: 780f8bf8-ec0b-47fc-a1bd-6204d5e16728
type: Opaque
```
```txt:secret(（access-keyが含まれている）
[root@new-syasuda-tok1-vpc1 ~]# oc get secrets sysdig-agent -n ibm-observe -o jsonpath='{.data.access-key}' | base64 -d
c63e9a9a-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```