@@ -23,34 +23,45 @@ The script outputs the following data from your namespace and creates a :
23
23
### Usage
24
24
25
25
1 . Save the script below as e.g. ` camunda-collect-diagnostics.sh ` .
26
- 2 . Replace ` <NAMESPACE> ` with the namespace of your Camunda deployment.
27
- 3 . Make the script executable.
26
+ 2 . Make the script executable:
28
27
29
28
``` bash
30
29
chmod +x camunda-collect-diagnostics.sh
31
30
```
32
31
33
- 4 . Run the script.
32
+ 3 . Execute the script replacing < namespace > with the namespace of your Camunda deployment:
34
33
35
34
``` bash
36
- ./camunda-collect-diagnostics.sh
35
+ ./camunda-collect-diagnostics.sh --namespace < namespace >
37
36
```
38
37
39
- 5 . Share the generated ` .zip ` archive with Camunda Support.
38
+ 4 . Share the generated ` .zip ` archive with Camunda Support.
40
39
41
40
### Diagnostic collection script
42
41
43
42
``` bash
44
43
#! /bin/bash
45
44
46
- # Define namespace
47
- namespace=< NAMESPACE>
45
+ # Parse arguments
46
+ while [[ " $# " -gt 0 ]]; do
47
+ case $1 in
48
+ --namespace) namespace=" $2 " ; shift ;;
49
+ * ) echo " Unknown parameter passed: $1 " ; exit 1 ;;
50
+ esac
51
+ shift
52
+ done
48
53
49
- # Check if NAMESPACE is set
50
- if [[ " $namespace " == " NAMESPACE " ]]; then
51
- echo " ERROR: Please set the 'namespace' variable in the script before running it ."
54
+ # Check if namespace is provided
55
+ if [[ -z " $namespace " ]]; then
56
+ echo " ERROR: Namespace not provided. Please run the script with the --namespace parameter ."
52
57
echo " Example:"
53
- echo " namespace=\" camunda-platform\" "
58
+ echo " ./camunda-collect-diagnostics.sh --namespace camunda-platform"
59
+ exit 1
60
+ fi
61
+
62
+ # Check if namespace exists
63
+ if ! kubectl get namespace " $namespace " > /dev/null 2>&1 ; then
64
+ echo " ERROR: Namespace '$namespace ' does not exist in the cluster."
54
65
exit 1
55
66
fi
56
67
@@ -82,6 +93,12 @@ kubectl get events -n "$namespace" --sort-by='.lastTimestamp' > events.txt
82
93
echo " - Collecting Persistent Volume Claims (PVCs) descriptions (storage claims in the namespace)."
83
94
kubectl describe pvc -n " $namespace " > pvc-describe.txt
84
95
96
+ echo " - Collecting Persistent Volumes (PVs) descriptions (underlying storage volumes)."
97
+ for pvc in $( kubectl get pvc -n " $namespace " --no-headers -o custom-columns=" :spec.volumeName" ) ; do
98
+ echo " - Collecting information for PV: $pvc "
99
+ kubectl describe pv " $pvc " >> pv-describe.txt
100
+ done
101
+
85
102
echo " - Collecting service information (list of services in the namespace)."
86
103
kubectl get svc -n " $namespace " > services.txt
87
104
@@ -100,22 +117,13 @@ kubectl describe ing -n "$namespace" > ingresses-describe.txt
100
117
echo " - Collecting config map information (configuration data stored in the namespace)."
101
118
kubectl get cm -n " $namespace " -o yaml > configmaps.yaml
102
119
103
- # Collect Persistent Volumes (PVs) relevant to the namespace
104
- echo " - Collecting Persistent Volumes (PVs):"
105
- for pvc in $( kubectl get pvc -n " $namespace " --no-headers -o custom-columns=" :spec.volumeName" ) ; do
106
- echo " - Collecting information for PV: $pvc "
107
- kubectl describe pv " $pvc " >> pv-describe.txt
108
- done
109
-
110
- # Get nodes relevant to the namespace
111
120
echo " - Collecting node information:"
112
121
for node in $( kubectl get pods -n " $namespace " -o wide --no-headers | awk ' {print $7}' | sort | uniq) ; do
113
122
echo " - Collecting information for node: $node "
114
123
kubectl describe node " $node " >> node-describe.txt
115
124
echo " " >> node-describe.txt
116
125
done
117
126
118
- # Collect logs and descriptions for each pod
119
127
echo " - Collecting logs and descriptions for each pod..."
120
128
for pod in $( kubectl get pod -n " $namespace " --no-headers -o custom-columns=" :metadata.name" ) ; do
121
129
echo " - Collecting logs for pod: $pod "
0 commit comments