├── README.md
├── status
├── status.css
└── status.html
├── k8sensor_uninstall
├── k8sensor
├── LICENSE
├── connector
└── agent
/README.md:
--------------------------------------------------------------------------------
1 | # aiops-insights-tools
2 | public tools for IBM AIops Insights project
3 |
--------------------------------------------------------------------------------
/status/status.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
4 | background: #f4f4f4;
5 | margin: 0;
6 | }
7 | .header {
8 | background: black;
9 | color: #ffffff;
10 | height: 3rem;
11 | display: flex;
12 | align-items: center;
13 | }
14 |
15 | .header-company-name {
16 | margin-left: 1rem;
17 | font-size: 14px;
18 | display: inline-block;
19 | }
20 |
21 | .header-product-name {
22 | font-size: 14px;
23 | font-weight: 600;
24 | display: inline-block;
25 | }
26 |
27 | .title {
28 | background: white;
29 | height: 9rem;
30 | display: flex;
31 | align-items: center;
32 | }
33 |
34 | .title-text {
35 | margin-left: 2rem;
36 | font-size: 32px;
37 | }
38 |
39 | .status {
40 | background: white;
41 | margin: 1rem;
42 | padding: 1rem;
43 | }
44 |
45 | .status-text {
46 | padding-top: 12px;
47 | font-size: 24px;
48 | }
49 |
50 | .upcoming-maintenance {
51 | background: white;
52 | margin: 1rem;
53 | padding: 1rem;
54 | }
55 |
56 | .upcoming-maintenance-text {
57 | padding-top: 12px;
58 | font-size: 24px;
59 | }
--------------------------------------------------------------------------------
/status/status.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
31 |
32 | Upcoming scheduled maintenance
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/k8sensor_uninstall:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | service_prefix="insight-k8sensor"
4 | suffix=".config"
5 | config_path="/opt/instana/agent/k8sensor/etc/"
6 | CONTAINER_ENGINE=podman
7 |
8 | function exists {
9 | if which "$1" >/dev/null 2>&1; then
10 | return 0
11 | else
12 | return 1
13 | fi
14 | }
15 |
16 | # Check if config_path exists and is a directory
17 | if [ ! -d "$config_path" ]; then
18 | echo "Directory $config_path does not exist."
19 | exit 1
20 | fi
21 |
22 | # Check if there are any files with the given suffix
23 | shopt -s nullglob
24 | filelist=("$config_path"/*"$suffix")
25 | if [ ${#filelist[@]} -eq 0 ]; then
26 | echo "No files with suffix $suffix found in $config_path."
27 | exit 1
28 | fi
29 |
30 | # Check Podman
31 | if ! exists $CONTAINER_ENGINE; then
32 | echo "$CONTAINER_ENGINE is not installed."
33 | exit 1
34 | fi
35 |
36 |
37 | for filepath in "$config_path"/*"$suffix"; do
38 | filename=$(basename "$filepath")
39 | service="${filename%$suffix}"
40 |
41 | echo "Stop the service: ${service_prefix}-${service}.service"
42 | systemctl stop -q ${service_prefix}-${service}.service > /dev/null 2>&1
43 | systemctl disable -q ${service_prefix}-${service}.service > /dev/null 2>&1
44 | systemctl reset-failed -q > /dev/null 2>&1
45 | systemctl daemon-reload -q > /dev/null 2>&1
46 |
47 | $CONTAINER_ENGINE stop "${service_prefix}-${service}" > /dev/null 2>&1
48 | $CONTAINER_ENGINE rm "${service_prefix}-${service}" > /dev/null 2>&1
49 |
50 | echo "Removing /etc/systemd/system/${service_prefix}-${service}.service"
51 | rm /etc/systemd/system/${service_prefix}-${service}.service > /dev/null 2>&1
52 | echo "Removing /opt/instana/agent/etc/k8sensor/${service}.config"
53 | rm "/opt/instana/agent/etc/k8sensor/${service}.config" > /dev/null 2>&1
54 | done
55 |
56 | # Reset nullglob back to its default state
57 | shopt -u nullglob
58 |
--------------------------------------------------------------------------------
/k8sensor:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | function log_error {
4 | local message=$1
5 |
6 | if [[ $TERM == *"color"* ]]; then
7 | echo -e "\e[31m$message\e[0m"
8 | else
9 | echo "${message}"
10 | fi
11 | }
12 |
13 | function log_info {
14 | local message=$1
15 |
16 | if [[ $TERM == *"color"* ]]; then
17 | echo -e "\e[32m$message\e[0m"
18 | else
19 | echo "${message}"
20 | fi
21 | }
22 |
23 | function log_debug {
24 | local message=$1
25 |
26 | if [[ $TERM == *"color"* ]]; then
27 | echo -e "\e[33m${message}\e[0m"
28 | else
29 | echo "${message}"
30 | fi
31 | }
32 |
33 | function exists {
34 | if which "$1" >/dev/null 2>&1; then
35 | return 0
36 | else
37 | return 1
38 | fi
39 | }
40 |
41 | # Check if the correct number of arguments was provided
42 | if [[ $# -lt 4 ]] || [[ $# -gt 5 ]]; then
43 | echo "NOTE: You should run the command with sudo as it starts the systemd service."
44 | echo "Usage: $0