5
5
# about RMT
6
6
# License: GPLv2
7
7
# Author: SCC Team <[email protected] >
8
- # Modified: 2018 April 18
8
+ # Modified: 2023-12- 18
9
9
# ############################################################
10
10
11
- SVER=0.0.2
12
- RCFILE=" /usr/lib/supportconfig/resources/scplugin.rc"
11
+ SVER=' 0.0.3'
12
+ RCFILE=" /usr/lib/supportconfig/resources/supportconfig.rc"
13
+ OF=' output-rmt.txt'
13
14
14
15
[ -s $RCFILE ] && . $RCFILE || { echo " ERROR: Initializing resource file: $RCFILE " ; exit 1; }
15
16
16
17
# # Our own helper functions
17
18
validate_rpm_if_installed () {
18
19
THISRPM=$1
19
- echo " #==[ Validating RPM ]=================================#"
20
+ log_write $OF ' #==[ Validating RPM ]=================================#'
20
21
if rpm -q " $THISRPM " > /dev/null 2>&1 ; then
21
- echo " # rpm -V $THISRPM "
22
-
23
- if rpm -V " $THISRPM " ; then
24
- echo " Status: Passed"
22
+ if rpm -V $THISRPM >> ${LOG} /${OF} 2>&1 ; then
23
+ log_write $OF " Status: Passed"
25
24
else
26
- echo " Status: WARNING"
25
+ log_write $OF " Status: WARNING"
27
26
fi
28
27
else
29
- echo " package $THISRPM is not installed"
30
- echo " Status: Skipped"
28
+ log_write $OF " package $THISRPM is not installed"
29
+ log_write $OF " Status: Skipped"
31
30
fi
32
- echo
31
+ log_write $OF
33
32
}
34
33
35
34
RPMLIST=(rmt-server nginx mariadb)
@@ -40,51 +39,51 @@ LOG_UNITS=(rmt-server.service rmt-server-migration.service rmt-server-sync.servi
40
39
41
40
CONF_FILES=(/etc/rmt.conf /etc/nginx/vhosts.d/rmt-server-http.conf /etc/nginx/vhosts.d/rmt-server-https.conf)
42
41
43
- section_header " Supportconfig Plugin for RMT, v${SVER} "
44
- if ! rpm -q rmt-server & > /dev/null; then
45
- echo -e " ERROR: RMT rpm package ('rmt-server') not installed\n"
46
- exit 111
47
- fi
42
+ log_entry $OF note " Supportconfig Plugin for RMT, v${SVER} "
43
+ rpm_verify $OF rmt-server || exit 111
44
+
45
+ log_entry $OF note ' Packages'
48
46
49
- plugin_tag " Packages"
50
47
for pkg in " ${RPMLIST[@]} " ; do
51
48
validate_rpm_if_installed " $pkg "
52
49
done
53
50
54
- plugin_tag " Configuration"
55
- pconf_files " $CONF_FILES "
51
+ log_entry $OF note " Configuration"
52
+ conf_files $OF " $CONF_FILES "
56
53
57
- plugin_tag " SSL Configuration"
58
- plugin_command " ls -l /usr/share/rmt/ssl/"
54
+ log_entry $OF note " SSL Configuration"
55
+ log_cmd $OF " ls -l /usr/share/rmt/ssl/"
59
56
60
57
if systemctl --quiet is-active nginx; then
61
- plugin_command " echo | openssl s_client -showcerts -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -inform pem -noout -text"
58
+ log_cmd $OF " echo | openssl s_client -showcerts -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -inform pem -noout -text"
62
59
else
63
60
for cert in /usr/share/rmt/ssl/rmt-ca.crt /usr/share/rmt/ssl/rmt-server.crt; do
64
- plugin_command " openssl x509 -inform pem -noout -text -in $cert "
61
+ log_cmd $OF " openssl x509 -inform pem -noout -text -in $cert "
65
62
done
66
63
fi
67
64
68
- plugin_tag " Service Status"
65
+ log_entry $OF note " Service Status"
69
66
for i in " ${STATUS_UNITS[@]} " ; do
70
- plugin_command " systemctl status $i "
67
+ log_cmd $OF " systemctl status $i "
71
68
done
72
69
73
- plugin_tag " Mirroring Status"
74
- plugin_command " rmt-cli products list"
75
- plugin_command " rmt-cli repos list"
70
+ log_entry $OF note " Mirroring Status"
71
+ log_cmd $OF " rmt-cli products list"
72
+ log_cmd $OF " rmt-cli repos list"
76
73
77
- plugin_tag " Service Logs"
74
+ log_entry $OF note " Service Logs"
78
75
for service in " ${LOG_UNITS[@]} " ; do
79
- plugin_command " journalctl -n1000 -u $service "
76
+ log_cmd $OF " journalctl -n1000 -u $service "
80
77
done
81
78
82
- plugin_tag " Custom Repos"
83
- plugin_command " rmt-cli repos custom list"
79
+ log_entry $OF note " Custom Repos"
80
+ log_cmd $OF " rmt-cli repos custom list"
84
81
custom_repos=$( rmt-cli repos custom list --csv 2> /dev/null | sed 1d | cut -d ' ,' -f 1)
85
82
if [ -n " $custom_repos " ]; then
86
83
for custom in $custom_repos ; do
87
- echo " Products bound to custom repo id: $custom "
88
- plugin_command " rmt-cli repos custom products $custom "
84
+ log_write $OF " Products bound to custom repo id: $custom "
85
+ log_cmd $OF " rmt-cli repos custom products $custom "
89
86
done
90
87
fi
88
+ _sanitize_file $OF
89
+
0 commit comments