--- rpms/smeserver-smeadmin/contribs10/smeserver-smeadmin-1.6-bz11062-initial-import.patch 2021/03/25 05:47:03 1.1
+++ rpms/smeserver-smeadmin/contribs10/smeserver-smeadmin-1.6-bz11062-initial-import.patch 2021/03/28 02:49:44 1.2
@@ -1,7 +1,24 @@
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/createlinks smeserver-smeadmin-1.6/createlinks
--- smeserver-smeadmin-1.6.old/createlinks 2020-10-15 07:31:28.000000000 -0400
-+++ smeserver-smeadmin-1.6/createlinks 2021-03-25 01:33:42.522000000 -0400
-@@ -22,10 +22,11 @@
++++ smeserver-smeadmin-1.6/createlinks 2021-03-27 22:41:19.452000000 -0400
+@@ -2,16 +2,8 @@
+
+ use esmith::Build::CreateLinks qw(:all);
+
+-# Start and stop links
+-service_link_enhanced("smeadmind", "S99", "7");
+-service_link_enhanced("smeadmind", "K97", "6");
+-service_link_enhanced("smeadmind", "K20", "0");
+-service_link_enhanced("smeadmind", "K20", "1");
+
+
+-# Start and stop links to lm_sensors
+-service_link_enhanced("lm_sensors", "S99", "7");
+-
+ # Links for the panel
+ panel_link("smeadmin", "manager");
+ #system("mkdir -p root/etc/e-smith/web/panels/manager/html/smeadmin");
+@@ -22,10 +14,11 @@
#Creation of the event smeadmin-update
for my $event (qw(
smeadmin-update
@@ -14,6 +31,12 @@ diff -Nur --no-dereference smeserver-sme
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smeadmind");
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/lm_sensors");
}
+@@ -39,3 +32,5 @@
+ safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/lm_sensors");
+ }
+
++#expand template
++templates2events("/etc/e-smith/sql/init/smeadmin", "smeserver-smeadmin-update")
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/db/configuration/migrate/smeadmin 2020-10-15 07:31:28.000000000 -0400
+++ smeserver-smeadmin-1.6/root/etc/e-smith/db/configuration/migrate/smeadmin 2021-03-25 01:29:34.607000000 -0400
@@ -35,28 +58,791 @@ diff -Nur --no-dereference smeserver-sme
if ( -e "/etc/e-smith/web/panels/manager/html/smeadmin/_smeadmin.conf" ){
diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin
--- smeserver-smeadmin-1.6.old/root/etc/e-smith/sql/init/smeadmin 2020-10-15 07:31:28.000000000 -0400
-+++ smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin 2021-03-25 01:31:40.870000000 -0400
-@@ -1,7 +1,7 @@
- #!/bin/bash
-
- # mysql
++++ smeserver-smeadmin-1.6/root/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500
+@@ -1,153 +0,0 @@
+-#!/bin/bash
+-
+-# mysql
-if [ -d /var/lib/mysql/sme8admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then
-+if [ -d /var/lib/mysql/sme9admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then
- echo "Migrating existing sme8admin MySQL database."
- mysqladmin create smeadmin
- mysqldump sme8admin | mysql smeadmin
-@@ -17,10 +17,10 @@
- fi
-
- # rrd
+- echo "Migrating existing sme8admin MySQL database."
+- mysqladmin create smeadmin
+- mysqldump sme8admin | mysql smeadmin
+- PASS=$(/sbin/e-smith/db configuration getprop smeadmind DbPassword)
+- mysql -e " grant all privileges on smeadmin.* to 'smeadmin'@'localhost' identified by '$PASS'"
+- mysqladmin flush-privileges
+-elif [ -e /var/lib/mysql/smeadmin ]; then
+- # c'est une mise jour, on fait une upgrade de la base si besoin
+- sh /usr/share/doc/smeserver-smeadmin/update-mysql.sh
+-else
+- #si c'est une freshinstall on cree la bd mysql
+- sh /usr/share/doc/smeserver-smeadmin/create-mysql.sh
+-fi
+-
+-# rrd
- # migrating previous sme8admin rrd
- if [ -d /var/lib/sme8admin ] && [ ! -d /var/lib/smeadmin ]; then
- echo "Migrating existing sme8admin RRDs files."
- cp -vr /var/lib/sme8admin /var/lib/smeadmin
+- fi
+-
+- #ADD more DS for version 1.5-10
+- #first we test if these DS are already in the sensors.rrd
+- if [[ -f /var/lib/smeadmin/sensors.rrd ]]; then
+- rrdtool dump /var/lib/smeadmin/sensors.rrd > /tmp/new_file.xml
+- testDS=$(grep -w 'fspd2\|thd3\|thd4\|thd5\|thd6' /tmp/new_file.xml)
+- rm -f /tmp/new_file.xml
+- fi
+- # then since the DS are not in the sensors.rrd we create it
+- if [[ -d /var/lib/smeadmin ]] && [[ ! $testDS ]]; then
+- #if (fspd2,thd3,thd4,thd5,thd6) don't exist, then we create it without nuked the data already existent
+- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd fspd2:GAUGE:600:0:10000
+- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd3:GAUGE:600:0:100
+- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd4:GAUGE:600:0:100
+- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd5:GAUGE:600:0:100
+- /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd6:GAUGE:600:0:100
+-
+-
+- elif [[ ! -d /var/lib/smeadmin ]]; then
+- #si c'est une freshinstall on cree les rrd
+- sh /usr/share/doc/smeserver-smeadmin/create-rrd.sh
+- fi
+- if [[ ! -f /var/lib/smeadmin/qpsmtpd.rrd ]]; then
+- # si le rrd qpsmtpd existe pas (nouveauté SME9)
+- rrdtool create /var/lib/smeadmin/qpsmtpd.rrd -s 300 \
+- DS:check_basicheaders:GAUGE:600:0:U \
+- DS:check_goodrcptto:GAUGE:600:0:U \
+- DS:clamav:GAUGE:600:0:U \
+- DS:karma:GAUGE:600:0:U \
+- DS:tls_failed:GAUGE:600:0:U \
+- DS:rhsbl:GAUGE:600:0:U \
+- DS:check_earlytalker:GAUGE:600:0:U \
+- DS:resolvable_fromhost:GAUGE:600:0:U \
+- DS:dnsbl:GAUGE:600:0:U \
+- DS:fcrdns:GAUGE:600:0:U \
+- DS:spf:GAUGE:600:0:U \
+- DS:check_spamhelo:GAUGE:600:0:U \
+- DS:uribl:GAUGE:600:0:U \
+- DS:dmarc:GAUGE:600:0:U \
+- DS:total_denied:GAUGE:600:0:U \
+- DS:spam_denied:GAUGE:600:0:U \
+- DS:other_denied:GAUGE:600:0:U \
+- DS:spam_queued:GAUGE:600:0:U \
+- DS:queued:GAUGE:600:0:U \
+- DS:total:GAUGE:600:0:U \
+- RRA:AVERAGE:0.5:1:12 \
+- RRA:AVERAGE:0.5:1:72 \
+- RRA:AVERAGE:0.5:1:288 \
+- RRA:AVERAGE:0.5:6:336 \
+- RRA:AVERAGE:0.5:24:372 \
+- RRA:AVERAGE:0.5:288:365 \
+- RRA:MAX:0.5:1:12 \
+- RRA:MAX:0.5:1:72 \
+- RRA:MAX:0.5:1:288 \
+- RRA:MAX:0.5:6:336 \
+- RRA:MAX:0.5:24:372 \
+- RRA:MAX:0.5:288:365 \
+- RRA:MIN:0.5:1:12 \
+- RRA:MIN:0.5:1:72 \
+- RRA:MIN:0.5:1:288 \
+- RRA:MIN:0.5:6:336 \
+- RRA:MIN:0.5:24:372 \
+- RRA:MIN:0.5:288:365
+- fi
+- if [[ ! -f /var/lib/smeadmin/qmail.rrd ]]; then
+- # nombre et raisons de connexions refusées ou acceptées et file d'attente
+- rrdtool create /var/lib/smeadmin/qmail.rrd -s 300 \
+- DS:local_failure:GAUGE:600:0:U \
+- DS:local_deferral:GAUGE:600:0:U \
+- DS:local_success:GAUGE:600:0:U \
+- DS:local_total:GAUGE:600:0:U \
+- DS:remote_failure:GAUGE:600:0:U \
+- DS:remote_deferral:GAUGE:600:0:U \
+- DS:remote_success:GAUGE:600:0:U \
+- DS:remote_total:GAUGE:600:0:U \
+- DS:local_queue:GAUGE:600:0:U \
+- DS:remote_queue:GAUGE:600:0:U \
+- RRA:AVERAGE:0.5:1:12 \
+- RRA:AVERAGE:0.5:1:72 \
+- RRA:AVERAGE:0.5:1:288 \
+- RRA:AVERAGE:0.5:6:336 \
+- RRA:AVERAGE:0.5:24:372 \
+- RRA:AVERAGE:0.5:288:365 \
+- RRA:MAX:0.5:1:12 \
+- RRA:MAX:0.5:1:72 \
+- RRA:MAX:0.5:1:288 \
+- RRA:MAX:0.5:6:336 \
+- RRA:MAX:0.5:24:372 \
+- RRA:MAX:0.5:288:365 \
+- RRA:MIN:0.5:1:12 \
+- RRA:MIN:0.5:1:72 \
+- RRA:MIN:0.5:1:288 \
+- RRA:MIN:0.5:6:336 \
+- RRA:MIN:0.5:24:372 \
+- RRA:MIN:0.5:288:365
+- fi
+- if [[ ! -f /var/lib/smeadmin/altqmail.rrd ]]; then
+- # nombre et raisons de connexions refusées ou acceptées et file d'attente
+- rrdtool create /var/lib/smeadmin/altqmail.rrd -s 300 \
+- DS:local_failure:GAUGE:600:0:U \
+- DS:local_deferral:GAUGE:600:0:U \
+- DS:local_success:GAUGE:600:0:U \
+- DS:local_total:GAUGE:600:0:U \
+- DS:remote_failure:GAUGE:600:0:U \
+- DS:remote_deferral:GAUGE:600:0:U \
+- DS:remote_success:GAUGE:600:0:U \
+- DS:remote_total:GAUGE:600:0:U \
+- DS:local_queue:GAUGE:600:0:U \
+- DS:remote_queue:GAUGE:600:0:U \
+- RRA:AVERAGE:0.5:1:12 \
+- RRA:AVERAGE:0.5:1:72 \
+- RRA:AVERAGE:0.5:1:288 \
+- RRA:AVERAGE:0.5:6:336 \
+- RRA:AVERAGE:0.5:24:372 \
+- RRA:AVERAGE:0.5:288:365 \
+- RRA:MAX:0.5:1:12 \
+- RRA:MAX:0.5:1:72 \
+- RRA:MAX:0.5:1:288 \
+- RRA:MAX:0.5:6:336 \
+- RRA:MAX:0.5:24:372 \
+- RRA:MAX:0.5:288:365 \
+- RRA:MIN:0.5:1:12 \
+- RRA:MIN:0.5:1:72 \
+- RRA:MIN:0.5:1:288 \
+- RRA:MIN:0.5:6:336 \
+- RRA:MIN:0.5:24:372 \
+- RRA:MIN:0.5:288:365
+- fi
+-
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin
+--- smeserver-smeadmin-1.6.old/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500
++++ smeserver-smeadmin-1.6/root/etc/e-smith/templates/etc/e-smith/sql/init/smeadmin 2021-03-25 15:32:13.964000000 -0400
+@@ -0,0 +1,153 @@
++#!/bin/bash
++
++# mysql
++if [ -d /var/lib/mysql/sme9admin ] && [ ! -d /var/lib/mysql/smeadmin ]; then
++ echo "Migrating existing sme9admin MySQL database."
++ mysqladmin create smeadmin
++ mysqldump sme9admin | mysql smeadmin
++ PASS=$(/sbin/e-smith/db configuration getprop smeadmind DbPassword)
++ mysql -e " grant all privileges on smeadmin.* to 'smeadmin'@'localhost' identified by '$PASS'"
++ mysqladmin flush-privileges
++elif [ -e /var/lib/mysql/smeadmin ]; then
++ # c'est une mise jour, on fait une upgrade de la base si besoin
++ sh /usr/share/doc/smeserver-smeadmin/update-mysql.sh
++else
++ #si c'est une freshinstall on cree la bd mysql
++ sh /usr/share/doc/smeserver-smeadmin/create-mysql.sh
++fi
++
++# rrd
+ # migrating previous sme9admin rrd
+ if [ -d /var/lib/sme9admin ] && [ ! -d /var/lib/smeadmin ]; then
+ echo "Migrating existing sme9admin RRDs files."
+ cp -vr /var/lib/sme9admin /var/lib/smeadmin
- fi
++ fi
++
++ #ADD more DS for version 1.5-10
++ #first we test if these DS are already in the sensors.rrd
++ if [[ -f /var/lib/smeadmin/sensors.rrd ]]; then
++ rrdtool dump /var/lib/smeadmin/sensors.rrd > /tmp/new_file.xml
++ testDS=$(grep -w 'fspd2\|thd3\|thd4\|thd5\|thd6' /tmp/new_file.xml)
++ rm -f /tmp/new_file.xml
++ fi
++ # then since the DS are not in the sensors.rrd we create it
++ if [[ -d /var/lib/smeadmin ]] && [[ ! $testDS ]]; then
++ #if (fspd2,thd3,thd4,thd5,thd6) don't exist, then we create it without nuked the data already existent
++ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd fspd2:GAUGE:600:0:10000
++ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd3:GAUGE:600:0:100
++ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd4:GAUGE:600:0:100
++ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd5:GAUGE:600:0:100
++ /usr/share/doc/smeserver-smeadmin/add_ds_to_rrd.pl /var/lib/smeadmin sensors.rrd thd6:GAUGE:600:0:100
++
++
++ elif [[ ! -d /var/lib/smeadmin ]]; then
++ #si c'est une freshinstall on cree les rrd
++ sh /usr/share/doc/smeserver-smeadmin/create-rrd.sh
++ fi
++ if [[ ! -f /var/lib/smeadmin/qpsmtpd.rrd ]]; then
++ # si le rrd qpsmtpd existe pas (nouveauté SME9)
++ rrdtool create /var/lib/smeadmin/qpsmtpd.rrd -s 300 \
++ DS:check_basicheaders:GAUGE:600:0:U \
++ DS:check_goodrcptto:GAUGE:600:0:U \
++ DS:clamav:GAUGE:600:0:U \
++ DS:karma:GAUGE:600:0:U \
++ DS:tls_failed:GAUGE:600:0:U \
++ DS:rhsbl:GAUGE:600:0:U \
++ DS:check_earlytalker:GAUGE:600:0:U \
++ DS:resolvable_fromhost:GAUGE:600:0:U \
++ DS:dnsbl:GAUGE:600:0:U \
++ DS:fcrdns:GAUGE:600:0:U \
++ DS:spf:GAUGE:600:0:U \
++ DS:check_spamhelo:GAUGE:600:0:U \
++ DS:uribl:GAUGE:600:0:U \
++ DS:dmarc:GAUGE:600:0:U \
++ DS:total_denied:GAUGE:600:0:U \
++ DS:spam_denied:GAUGE:600:0:U \
++ DS:other_denied:GAUGE:600:0:U \
++ DS:spam_queued:GAUGE:600:0:U \
++ DS:queued:GAUGE:600:0:U \
++ DS:total:GAUGE:600:0:U \
++ RRA:AVERAGE:0.5:1:12 \
++ RRA:AVERAGE:0.5:1:72 \
++ RRA:AVERAGE:0.5:1:288 \
++ RRA:AVERAGE:0.5:6:336 \
++ RRA:AVERAGE:0.5:24:372 \
++ RRA:AVERAGE:0.5:288:365 \
++ RRA:MAX:0.5:1:12 \
++ RRA:MAX:0.5:1:72 \
++ RRA:MAX:0.5:1:288 \
++ RRA:MAX:0.5:6:336 \
++ RRA:MAX:0.5:24:372 \
++ RRA:MAX:0.5:288:365 \
++ RRA:MIN:0.5:1:12 \
++ RRA:MIN:0.5:1:72 \
++ RRA:MIN:0.5:1:288 \
++ RRA:MIN:0.5:6:336 \
++ RRA:MIN:0.5:24:372 \
++ RRA:MIN:0.5:288:365
++ fi
++ if [[ ! -f /var/lib/smeadmin/qmail.rrd ]]; then
++ # nombre et raisons de connexions refusées ou acceptées et file d'attente
++ rrdtool create /var/lib/smeadmin/qmail.rrd -s 300 \
++ DS:local_failure:GAUGE:600:0:U \
++ DS:local_deferral:GAUGE:600:0:U \
++ DS:local_success:GAUGE:600:0:U \
++ DS:local_total:GAUGE:600:0:U \
++ DS:remote_failure:GAUGE:600:0:U \
++ DS:remote_deferral:GAUGE:600:0:U \
++ DS:remote_success:GAUGE:600:0:U \
++ DS:remote_total:GAUGE:600:0:U \
++ DS:local_queue:GAUGE:600:0:U \
++ DS:remote_queue:GAUGE:600:0:U \
++ RRA:AVERAGE:0.5:1:12 \
++ RRA:AVERAGE:0.5:1:72 \
++ RRA:AVERAGE:0.5:1:288 \
++ RRA:AVERAGE:0.5:6:336 \
++ RRA:AVERAGE:0.5:24:372 \
++ RRA:AVERAGE:0.5:288:365 \
++ RRA:MAX:0.5:1:12 \
++ RRA:MAX:0.5:1:72 \
++ RRA:MAX:0.5:1:288 \
++ RRA:MAX:0.5:6:336 \
++ RRA:MAX:0.5:24:372 \
++ RRA:MAX:0.5:288:365 \
++ RRA:MIN:0.5:1:12 \
++ RRA:MIN:0.5:1:72 \
++ RRA:MIN:0.5:1:288 \
++ RRA:MIN:0.5:6:336 \
++ RRA:MIN:0.5:24:372 \
++ RRA:MIN:0.5:288:365
++ fi
++ if [[ ! -f /var/lib/smeadmin/altqmail.rrd ]]; then
++ # nombre et raisons de connexions refusées ou acceptées et file d'attente
++ rrdtool create /var/lib/smeadmin/altqmail.rrd -s 300 \
++ DS:local_failure:GAUGE:600:0:U \
++ DS:local_deferral:GAUGE:600:0:U \
++ DS:local_success:GAUGE:600:0:U \
++ DS:local_total:GAUGE:600:0:U \
++ DS:remote_failure:GAUGE:600:0:U \
++ DS:remote_deferral:GAUGE:600:0:U \
++ DS:remote_success:GAUGE:600:0:U \
++ DS:remote_total:GAUGE:600:0:U \
++ DS:local_queue:GAUGE:600:0:U \
++ DS:remote_queue:GAUGE:600:0:U \
++ RRA:AVERAGE:0.5:1:12 \
++ RRA:AVERAGE:0.5:1:72 \
++ RRA:AVERAGE:0.5:1:288 \
++ RRA:AVERAGE:0.5:6:336 \
++ RRA:AVERAGE:0.5:24:372 \
++ RRA:AVERAGE:0.5:288:365 \
++ RRA:MAX:0.5:1:12 \
++ RRA:MAX:0.5:1:72 \
++ RRA:MAX:0.5:1:288 \
++ RRA:MAX:0.5:6:336 \
++ RRA:MAX:0.5:24:372 \
++ RRA:MAX:0.5:288:365 \
++ RRA:MIN:0.5:1:12 \
++ RRA:MIN:0.5:1:72 \
++ RRA:MIN:0.5:1:288 \
++ RRA:MIN:0.5:6:336 \
++ RRA:MIN:0.5:24:372 \
++ RRA:MIN:0.5:288:365
++ fi
++
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin
+--- smeserver-smeadmin-1.6.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin 1969-12-31 19:00:00.000000000 -0500
++++ smeserver-smeadmin-1.6/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/smeadmin 2021-03-27 22:39:01.822000000 -0400
+@@ -0,0 +1 @@
++PERMS=0750
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin
+--- smeserver-smeadmin-1.6.old/root/etc/e-smith/web/functions/smeadmin 2020-10-15 07:31:28.000000000 -0400
++++ smeserver-smeadmin-1.6/root/etc/e-smith/web/functions/smeadmin 2021-03-27 22:31:54.326000000 -0400
+@@ -368,13 +368,13 @@
+ #liste des services et classification
+ my @services = ("#".gettext("Web services"),"httpd-e-smith","httpd-admin","squid",
+ "#".gettext("Administrative services"), "sshd", "smeadmind",
+- "#".gettext("Network services"),"wan","dhcpd","pptpd","ippp",
++ "#".gettext("Network services"),"wan","dhcpd","pptpd","ippp","bridge","openvpn-s2s","openvpn-routed","openvpn-bridge","wireguard","ipsec","vpnserver",
+ "#".gettext("File-sharing services"),"smb","smbd","nmbd","ftp",
+- "#".gettext("E-mail services"),"pop3","pop3s","dovecot","imaps","imap","qmail","altqmail","qpsmtpd","sqpsmtpd", "clamd", "freshclam","spamd",#mail
++ "#".gettext("E-mail services"),"pop3","pop3s","dovecot","imaps","imap","qmail","altqmail","qpsmtpd","sqpsmtpd","smtp-auth-proxy", "clamd", "freshclam","spamd",#mail
+ "#".gettext("DNS services"),"tinydns","dnscache", #dns
+- "#".gettext("Authentication services"),"oidentd","ldap","smtp-auth-proxy","radiusd", #auth
+- "#".gettext("Misc. services"),"mysqld","ntpd","lpd", #misc
+- "#".gettext("System services"),"crond","rsyslog","ulogd","acpid","raidmonitor"); #sys et materiel
++ "#".gettext("Authentication services"),"oidentd","ldap","smtp-auth-proxy","radiusd","cvm-unix", #auth
++ "#".gettext("Misc. services"),"mariadb","ntpd","lpd", #misc
++ "#".gettext("System services"),"crond","rsyslog","ulogd","acpid","raidmonitor","local", "yum"); #sys et materiel
+
+ #hack pour la mise en forme : a) debut 1er case a gauche
+ print $q->start_table,$q->start_Tr,$q->start_td;
+@@ -396,24 +396,27 @@
+ #si c'est un 'header'
+ if ($svc=~/^#(.*)/)
+ {
+- print $q->Tr(),$q->Tr($q->th($1),$q->th(gettext("State")),$q->th(gettext("Action")),$q->th("DB Status"),$q->th("DB Action"));
++ print $q->Tr(),$q->Tr($q->th($1),$q->th(gettext("State")),$q->th(gettext("Action")),$q->th("DB Status"),$q->th("DB Action"));
+ }
+ else
+ {
+- #si c'est un service pour lequel on a des infos complementaires...
++ #si c'est un service pour lequel on a des infos complementaires...
+ if($svc=~/^(httpd-e-smith|httpd-admin|smb|smbd|nmbd|squid|pptpd|dhcpd|sshd|ftp|pppoe|pppd|wan|altqmail|qmail|qpsmtpd|sqpsmtpd)$/) {$details=1;}
+ if ( -d "/service/$svc") {$cmd = "/usr/bin/sv s $svc";} # was -d /var/service or -d /service/
+- elsif ($svc=~/^(imaps|imap)$/) { $cmd = "/usr/bin/sv s dovecot"; }
+- else {$cmd = "/sbin/e-smith/service $svc status|/bin/grep $svc";}
++ elsif ($svc=~/^(imaps|imap|pop3|pop3s)$/) { $cmd = "/usr/bin/systemctl is-active dovecot"; }
++ else {$cmd = "/usr/bin/systemctl is-active $svc";}
+ my @res=`$cmd`;
+- foreach (@res)
++
++ foreach (@res)
+ {
++ my $dbsv=$smedb->get("$svc") ||next;
+ # workaround to see db config status
+ my $dbstatus="not defined";
++
+ if ( length(`/sbin/e-smith/db configuration show $svc`) > 1 )
+ {$dbstatus=$smedb->get("$svc")->prop('status');} # trouver un moyen de verifier que le nom du service est bien trouvé dans liste
+ else
+- {$dbstatus=""; }
++ {$dbstatus="";}
+ #print "$svc :".length(`/sbin/e-smith/db configuration show $svc`)."
";
+
+ #print $q->p($_);
+@@ -424,42 +427,39 @@
+ #Warning !! Only on sme6
+ #proftpd est arrete
+
+- if ($svc=~/^(imaps|imap)$/)
+- {
+- print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")),
+- $q->td(""),$q->td( "dovecot" ) ,$q->td("$dbstatus"), $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) );
++ if ($svc=~/^(imaps|imap|pop3|pop3s)$/)
++ {
++ print $q->Tr(
++ (($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")),
++ $q->td(""),$q->td( "dovecot" ) ,
++ $q->td("$dbstatus"),
++ $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") )
++ );
+
+
+- }
+- #si le service est arrete^:il ya down ou il n'y a pas de () pour le pid et ca ne fini pas par ...
+- elsif(/^down:/ || /^([a-zA-Z0-9]*) [^(^)]*([^.]{3})$/)
+- {
++ }
++ #si le service est arrete^:il ya down ou il n'y a pas de () pour le pid et ca ne fini pas par ...
++ elsif(/^down:/ || /^([a-zA-Z0-9]*) [^(^)]*([^.]{3})$/ || /^failed/ || /^unknown/)
++ {
+ #on fait une conditionnelle pour savoir si on met le nom du service en lien ou pas
+ print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")),
+ $q->td(gettext("Stopped")),$q->td( (("$dbstatus" eq "enabled" || "$dbstatus" eq "" )? $q->submit(-name=>"start_$svc",-value=>'start'): "disabled") ) ,$q->td("$dbstatus"),
+ $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) );
+- }
+-
+- #MATCHE:
+- #/service/raidmonitor: run (pid 1629) 5747 seconds, normally down
+- #clamd (pid 2221) en cours d'exécution...
+- #atalkd (pid 6445) is running...
+- #Warning !! Only on sme6
+- #/service/popd: up (pid 22340) 101687 seconds, normally down
+- #sme6admind (pid 14320) en cours d'execution
+-
+- #si le service tourne
+- elsif (/^run:(.*)\(pid ([\d\s]+)\)/ || /^([a-zA-Z0-9]*) \(pid ([\d\s]+)\).*\.\.\.$/ )
+- {
++ }
++ elsif (/^run:(.*)\(pid ([\d\s]+)\)/ || /^([a-zA-Z0-9]*) \(pid ([\d\s]+)\).*\.\.\.$/ || /^active/ )
++ {
+ #$2=liste pids
+- my @pids=split(/ /,$2);
++ my @pids;
++ @pids=split(/ /,$2) if defined $2;
+
+- print $q->Tr((($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")),
+- $q->td(gettext("Started")),$q->td($q->submit(-name=>"stop_$svc",-value=>'stop')) ,$q->td("$dbstatus"),
+- $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) );
+- }
+- }
+- }
++ print $q->Tr(
++ (($details==1)? $q->td($q->a({href=>"$progname?state=service_detail&service=$svc"},"$svc")) : $q->td("$svc")),
++ $q->td(gettext("Started")),
++ $q->td($q->submit(-name=>"stop_$svc",-value=>'stop')) ,$q->td("$dbstatus"),
++ $q->td( ( ("$dbstatus" ne "") ? (("$dbstatus" eq "enabled" )? $q->submit(-name=>"disabled_$svc",-value=>'disable'): $q->submit(-name=>"enabled_$svc",-value=>'enable')) : " ") ) );
++ }
++ }
++ }
+ }
+
+ #service_control est le parametre qui prend le nom du service a arreter/demarrer
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/etc/rc.d/init.d/smeadmind smeserver-smeadmin-1.6/root/etc/rc.d/init.d/smeadmind
+--- smeserver-smeadmin-1.6.old/root/etc/rc.d/init.d/smeadmind 2020-10-15 07:31:28.000000000 -0400
++++ smeserver-smeadmin-1.6/root/etc/rc.d/init.d/smeadmind 1969-12-31 19:00:00.000000000 -0500
+@@ -1,59 +0,0 @@
+-#!/bin/sh
+-# Smeadmin - script shell pour l'arret/demarrage du service
+-# Copyright (C) 2006
+-# This file is distributed under the GPL license.
+-# Landry Breuil , 2006.
+-
+-# description: service de surveillance du systeme
+-# chkconfig: 345 97 03
+-
+-# Source function library.
+-. /etc/rc.d/init.d/functions
+-
+-RETVAL=0
+-
+-# See how we were called.
+-case "$1" in
+- start)
+- echo -n "Starting smeadmin daemon: "
+- # Not shutdown correctly ?
+- if [ -f /var/run/smeadmin.pid ]; then
+- kill `cat /var/run/smeadmin.pid` >/dev/null 2>&1
+- rm -f /var/run/smeadmin.pid >/dev/null 2>&1
+- rm -f /var/lock/subsys/smeadmin && rm -f /var/lock/smeadmin
+- fi
+- daemon /usr/bin/smeadmind
+- RETVAL=$?
+- echo
+- [ $RETVAL -eq 0 ] && touch /var/lock/subsys/smeadmin
+- ;;
+- stop)
+- echo -n "Stopping smeadmin daemon: "
+- killproc smeadmind
+- RETVAL=$?
+- rm -f /var/lock/subsys/smeadmin && rm -f /var/lock/smeadmin
+- echo
+- ;;
+- status)
+- status smeadmind
+- RETVAL=$?
+- ;;
+- restart)
+- $0 stop
+- $0 start
+- RETVAL=$?
+- ;;
+- reload)
+- echo -n "Smeadmin configuration reloaded: "
+- # A VOIR !!
+- kill -1 `cat /var/run/smeadmin.pid`
+- RETVAl=$?
+- echo
+- ;;
+- *)
+- echo "Usage: $0 {start|stop|status|restart|reload}"
+- exit 1
+-esac
+-
+-exit $RETVAL
+-
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind smeserver-smeadmin-1.6/root/usr/bin/smeadmind
+--- smeserver-smeadmin-1.6.old/root/usr/bin/smeadmind 2020-10-15 07:31:28.000000000 -0400
++++ smeserver-smeadmin-1.6/root/usr/bin/smeadmind 2021-03-27 22:30:13.364000000 -0400
+@@ -89,17 +89,18 @@
- #ADD more DS for version 1.5-10
+ #tableau des chemins des logs qui nous interessent
+ #TO SEE
+-my @logs= ( "clamd/current", # pour les VIRUS ???
+- "spamd/current", #pour les SPAMS
+- "sshd/current", #pour les connexions ssh
+- "messages",
+- "qmail/current", #pour les mails IN/OUT
+- "altqmail/current", #pour les mails OUT
+- "qpsmtpd/current", #pour les SPAM/VIRUS ??
+- "sqpsmtpd/current", #idem pour les connexions securisées
+- "proftpd/current", #pour la date de fin de connection FTP
+- "secure", #pour les connexion FTP avec le username authentifie
+- "xferlog"); #pour les details des transferts ftp
++my @logs= ( "clamd/current", # VIRUS ???
++ "spamd/spamd.log", # SPAMS
++ "sshd/sshd.log", # ssh connections
++ "messages", # afpd pppd and others not with dedicated logs
++ "dhcpd/dhcpd.log", # dhcpd
++ "qmail/current", # mails IN/OUT
++ "altqmail/current", # mails OUT
++ "qpsmtpd/current", # SPAM/VIRUS ??
++ "sqpsmtpd/current", # SPAM/VIRUS ??
++ "proftpd/proftpd.log", # start and end of ftp session
++ "secure", # FTP session with usernam auth
++ "xferlog"); # file transfer with ftp
+
+ #handle bd mySQL
+ my $bd;
+@@ -296,6 +297,9 @@
+ my $cont=0;
+ while(1)
+ {
++ #step 0 let's reread the logs, so we do not need to restart
++ readConf();
++
+ # etape 1 : parsage des logs
+ parse_logs();
+
+@@ -358,7 +362,8 @@
+ $DomainName = $smedb->get('DomainName')->value;
+ $SystemName = $smedb->get('SystemName')->value;
+ $SystemMode = $smedb->get("SystemMode")->value;
+-
++ $DEBUG = $smedb->get('smeadmind')->prop('DEBUG') || "0";
++
+ #on n'a une external ip que si on est en server-passerelle
+ if ($SystemMode =~ /servergateway/) {
+ $ExternalIP = $smedb->get("ExternalIP")->value;
+@@ -480,9 +485,11 @@
+ # ici on met a jour volume connexion meme si pas fini si pppoe et si pas trouvé de fin dans log
+ my $smedb=esmith::ConfigDB->open;
+ my $ppoeif = $smedb->get("ExternalInterface")->prop('Name');
++ my $ppoemode = $smedb->get("ExternalInterface")->prop('Configuration');
+
+ #for sme9 in server-only, the external interface is set to none
+- if ($ppoeif ne 'none') {
++ #for sme10 we add test we are using pppoe
++ if ($ppoeif ne 'none' && $ppoemode eq 'pppoe') {
+
+ my $recBytes=`cat /proc/net/dev|grep $ppoeif|cut -d ':' -f2|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d ' ' -f1`;
+ my $senBytes=`cat /proc/net/dev|grep $ppoeif|tr -s ' '| sed -e 's/^[ \t]*//'|cut -d " " -f9`;
+@@ -550,13 +557,15 @@
+ #parsage de la difference entre les 2 logs
+ #si la difference a donne qqch
+ #parse SSHD log to catch ssh connections/bruteforce
+- if ($nom eq "sshd/current") {
++ if ($nom eq "sshd/sshd.log") {
++ debug "sshd: ";
+ while ( defined(my $l = <$fh>)) {
+ chomp $l;
+ #Match: @TAI64 Accepted password for user from ip port prt mode
+ # "@4000000043a7f6970980de74 Accepted password for root from 10.246.200.10 port 60693 ssh2"
+ # "@4000000043a800192a7e131c Accepted publickey for root from 10.246.200.10 port 46322 ssh2"
+-
++ # SME10
++ # "Mar 23 16:57:38 sme10 sshd[9666]: Accepted publickey for root from 192.168.12.70 port 60224 ssh2: RSA SHA256:uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu"
+ if($l =~ /^(@[0-9a-f]{24}) Accepted (password|publickey) for (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) {
+ #$1:date $2:methode $3:login $4.$5.$6.$7:ip
+ #open connexion ssh reussie
+@@ -564,9 +573,20 @@
+ my $date=tai2strftime($1,"%F %T");
+ my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$3'");
+ #si on a trouve pas trouve une ligne ==> insert
++ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$3'\n";
+ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$3','1')") if ($reslt eq "0E0");
+ next;
+ }
++ elsif ($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName sshd\[(\d+)\]: Accepted (password|publickey) for (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) {
++ #$1:date $2:methode $3:login $4.$5.$6.$7:ip
++ #open connexion ssh reussie
++ my $ip=ipdot2ipnum($5,$6,$7,$8);
++ my $date=mkmysqldate($1);
++ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'\n";
++ my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'") ;
++ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$4','1')") if ($reslt eq "0E0");;
++ next;
++ }
+
+ #Match: @TAI64 Failed password for (|invalid user) user from ip port prt mode
+ #matche ces 2 lignes
+@@ -583,6 +603,17 @@
+ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$3','0')") if ($reslt eq "0E0");
+ next;
+ }
++ elsif ($l =~ /(\w{3}\s{1,2}\d{1,2} [0-9:]{8}) $SystemName sshd\[(\d+)\]: Failed for(| invalid user) (\w+) from (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/) {
++ #$1:date $2:methode $3:login $4.$5.$6.$7:ip
++ #open connection ssh failed
++ my $ip=ipdot2ipnum($5,$6,$7,$8);
++ my $date=mkmysqldate($1);
++ debug "SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'\n";
++ my $reslt=execute_sql_query("SELECT * FROM ssh WHERE ip='$ip' and debut='$date' and login='$4'");
++ execute_sql_query("INSERT INTO ssh VALUES ('$date','$ip','$4','0')") if ($reslt eq "0E0");;
++ next;
++ }
++
+ }
+ }
+
+@@ -614,7 +645,7 @@
+ }
+ }
+ #ici on matche les fins de connexion ftp (reussies ou non)
+- elsif ($nom eq "proftpd/current") {
++ elsif ($nom eq "proftpd/proftpd.log") {
+ while ( defined(my $l = <$fh>)) {
+ chomp $l;
+ #@4000000043973d2916bb3c9c tcpsvd: info: end 9952 exit 0
+@@ -658,10 +689,12 @@
+ if ($l =~ /FOUND/) {$net_virus++;next;}
+ }
+ }
+- elsif ($nom eq "spamd/current") {
++ elsif ($nom eq "spamd/spamd.log") {
+ while ( defined(my $l = <$fh>)) {
+ chomp $l;
+ #@4000000043a1c3ab1ff72c94 2005-12-15 19:27:29 [4838] i: identified spam (997.2/3.0) for qpsmtpd:1005 in 2.2 seconds, 557 bytes.
++ # SME10
++ #Mar 25 18:40:17 sacrum check[12093]: spamd: identified spam (98.8/4.0) for qpsmtpd:1005 in 17.4 seconds, 211566 bytes.
+ if($l =~ /identified spam/) {$net_spam++;next;}
+ }
+ }
+@@ -723,10 +756,10 @@
+ $cntaqmlocal{total} = $cntaqmlocal{total} + $cntaqmlocal{$_} if $_ !~ /total/;
+ }
+ ## add qmail local queue
+- $localaqueue=`find /var/service/altqmail/root/var/qmail/queue/local/ -type f | wc -l`;
++ $localaqueue=`find /var/service/altqmail/root/var/qmail/queue/local/ -type f 2>/dev/null| wc -l` || "0";
+ $localaqueue=~ s/\D+//g;
+ ### add qmail remote queue
+- $remoteaqueue=`find /var/service/altqmail/root/var/qmail/queue/remote/ -type f | wc -l`;
++ $remoteaqueue=`find /var/service/altqmail/root/var/qmail/queue/remote/ -type f 2>/dev/null| wc -l` ||"0";
+ $remoteaqueue=~ s/\D+//g;
+ $net_amail_out=$cntaqm{total};
+
+@@ -789,7 +822,7 @@
+
+ }
+
+- elsif ($nom eq "messages") {
++ elsif ($nom eq "/dhcpd/dhcpd.log") {
+ while ( defined(my $l = <$fh>)) {
+ #Baux DHCP
+ #/var/log/messages:Nov 28 19:34:14 sme7b5 dhcpd: DHCPACK on 192.168.1.250 to 00:e0:4c:39:03:a5 via eth0
+@@ -811,7 +844,10 @@
+ $net_dhcp++;
+ next;
+ }
+-
++ }
++ }
++ elsif ($nom eq "messages") {
++ while ( defined(my $l = <$fh>)) {
+ #Connexion afp (beta test ??) 1-ouverture session (548==>port afpovertcp)
+ #Jul 13 11:50:02 sas afpd[30668]: ASIP session:548(2) from 192.168.150.12:49278(0)
+ #Match: mmm dd hh:mm:ss hostname afpd[pid]: ASIP session:548(xxxx)?? from ip:port(xx?)
+@@ -1355,41 +1391,45 @@
+ # cette fonction met a jour les RRDs. Elle a ete "factorisee" pour plus de lisibilite
+ sub update_rrd {
+ #DEBUG !!
+-# print "sensors_temp1=$sensors_temp1,sensors_temp_hd1=$sensors_temp_hd1,sensors_temp_hd2=$sensors_temp_hd2,";
+-# print "sensors_temp2=$sensors_temp2,sensors_fan_speed=$sensors_fan_speed,sensors_fan2_speed=$sensors_fan2_speed\n";
+-# print "hd_total=$hd_total,hd_used=$hd_used,hd_free=$hd_free,hd_log=$hd_log,";
+-# print "hd_files=$hd_files,hd_squid=$hd_squid,hd_mysql=$hd_mysql,hd_blkread=$hd_blkread,hd_blkwrite=$hd_blkwrite\n";
+-# print "if_loc_bin=$if_loc_bin,if_loc_bout=$if_loc_bout,if_loc_pin=$if_loc_pin,if_loc_pout=$if_loc_pout\n";
+-# print "if_ext_bin=$if_ext_bin,if_ext_bout=$if_ext_bout,if_ext_pin=$if_ext_pin,if_ext_pout=$if_ext_pout\n";
+-# print "net_samba=$net_samba,net_minlatency=$net_minlatency,net_avglatency=$net_avglatency,";
+-# print "net_maxlatency=$net_maxlatency,net_loss=$net_loss,net_spam=$net_spam,net_virus=$net_virus,";
+-# print "net_dhcp=$net_dhcp,net_mail_in=$net_mail_in,net_mail_out=$net_mail_out\n";
+-# print "cpu_total=$cpu_total,cpu_idle=$cpu_idle,cpu_system=$cpu_system,cpu_user=$cpu_user\n";
+-# print "cpu_nice=$cpu_nice,cpu_plist=$cpu_plist,cpu_runq=$cpu_runq";
+-# print "cpu_load1=$cpu_load1,cpu_load5=$cpu_load5,cpu_load15=$cpu_load15,cpu_uptime=$cpu_uptime\n";
+-# print "mem_memtotal=$mem_memtotal,mem_memused=$mem_memused,mem_memfree=$mem_memfree";
+-# print "mem_memactualused=$mem_memactualused,mem_memactualfree=$mem_memactualfree\n";
+-# print "mem_membuffers=$mem_membuffers,mem_memcache=$mem_memcache";
+-# print "mem_swaptotal=$mem_swaptotal,mem_swapused=$mem_swapused,mem_swapfree=$mem_swapfree\n";
+-# print "httpd cpu=$httpd_cpu, mem=$httpd_mem, nb=$httpd_nbproc\n";
+-# print "samba cpu=$samba_cpu, mem=$samba_mem, nb=$samba_nbproc\n";
+-# print "afp cpu=$afp_cpu, mem=$afp_mem, nb=$afp_nbproc\n";
+-# print "squid cpu=$squid_cpu, mem=$squid_mem, nb=$squid_nbproc\n";
+-# print "sessions_ftp=$sessions_ftp,sessions_ssh=$sessions_ssh,";
+-# print "sessions_vpn=$sessions_vpn,sessions_netbios=$sessions_netbios\n";
+-# print "check_basicheaders=$mail_in_check_basicheaders,check_earlytalker=$mail_in_check_earlytalker,check_goodrcptto=$mail_in_check_goodrcptto,check_spamhelo=$mail_in_check_spamhelo,"
++ debug "sensors_temp1=$sensors_temp1,sensors_temp_hd1=$sensors_temp_hd1,sensors_temp_hd2=$sensors_temp_hd2,";
++ debug "sensors_temp2=$sensors_temp2,sensors_fan_speed=$sensors_fan_speed,sensors_fan2_speed=$sensors_fan2_speed\n";
++ debug "hd_total=$hd_total,hd_used=$hd_used,hd_free=$hd_free,hd_log=$hd_log,";
++ debug "hd_files=$hd_files,hd_squid=$hd_squid,hd_mysql=$hd_mysql,hd_blkread=$hd_blkread,hd_blkwrite=$hd_blkwrite\n";
++ debug "if_loc_bin=$if_loc_bin,if_loc_bout=$if_loc_bout,if_loc_pin=$if_loc_pin,if_loc_pout=$if_loc_pout\n";
++ debug "if_ext_bin=$if_ext_bin,if_ext_bout=$if_ext_bout,if_ext_pin=$if_ext_pin,if_ext_pout=$if_ext_pout\n";
++ debug "net_samba=$net_samba,net_minlatency=$net_minlatency,net_avglatency=$net_avglatency,";
++ debug "net_maxlatency=$net_maxlatency,net_loss=$net_loss,net_spam=$net_spam,net_virus=$net_virus,";
++ debug "net_dhcp=$net_dhcp,net_mail_in=$net_mail_in,net_mail_out=$net_mail_out\n";
++ debug "cpu_total=$cpu_total,cpu_idle=$cpu_idle,cpu_system=$cpu_system,cpu_user=$cpu_user\n";
++ debug "cpu_nice=$cpu_nice,cpu_plist=$cpu_plist,cpu_runq=$cpu_runq";
++ debug "cpu_load1=$cpu_load1,cpu_load5=$cpu_load5,cpu_load15=$cpu_load15,cpu_uptime=$cpu_uptime\n";
++ debug "mem_memtotal=$mem_memtotal,mem_memused=$mem_memused,mem_memfree=$mem_memfree";
++ debug "mem_memactualused=$mem_memactualused,mem_memactualfree=$mem_memactualfree\n";
++ debug "mem_membuffers=$mem_membuffers,mem_memcache=$mem_memcache";
++ debug "mem_swaptotal=$mem_swaptotal,mem_swapused=$mem_swapused,mem_swapfree=$mem_swapfree\n";
++ debug "httpd cpu=$httpd_cpu, mem=$httpd_mem, nb=$httpd_nbproc\n";
++ debug "samba cpu=$samba_cpu, mem=$samba_mem, nb=$samba_nbproc\n";
++ debug "afp cpu=$afp_cpu, mem=$afp_mem, nb=$afp_nbproc\n";
++ debug "squid cpu=$squid_cpu, mem=$squid_mem, nb=$squid_nbproc\n";
++ debug "sessions_ftp=$sessions_ftp,sessions_ssh=$sessions_ssh,";
++ debug "sessions_vpn=$sessions_vpn,sessions_netbios=$sessions_netbios\n";
++# debug "check_basicheaders=$mail_in_check_basicheaders,check_earlytalker=$mail_in_check_earlytalker,check_goodrcptto=$mail_in_check_goodrcptto,check_spamhelo=$mail_in_check_spamhelo,"
+ #."clamav=$mail_in_clamav,dmarc=$mail_in_dmarc,dnsbl=$mail_in_dnsbl,fcrdns=$mail_in_fcrdns,karma=$mail_in_karma,other_denied=$mail_in_other_denied,queued=$mail_in_queued,resolvable_fromhost=$mail_in_resolvable_fromhost,"
+ #."rhsbl=$mail_in_rhsbl,spam_denied=$mail_in_spam_denied,spam_queued=$mail_in_spam_queued,spf=$mail_in_spf,tls_failed=$mail_in_tls_failed,total=$mail_in_total,total_denied=$mail_in_total_denied,uribl=$mail_in_uribl\n";
+-# foreach (keys %denied,@others){ print "$_: $cnt{$_},";}; print "\n";
+-# print join(':', map {$cnt{$_}} keys %denied,@others); print "\n";
+- print "qmail ";
+- foreach (@resultsqm){ print "local_$_:$cntqmlocal{$_},";}; foreach (@resultsqm){ print "$_:$cntqm{$_},";};
+- print "localqueue=$localqueue,remotequeue=$remotequeue\n";
+-# print join(':', map {$cntqmlocal{$_}} @resultsqm) .":". join(':', map {$cntqm{$_}} @resultsqm); print ":". $localqueue .":". $remotequeue; print "\n";
+- print "altqmail ";
+- foreach (@resultsaqm){ print "local_$_:$cntaqmlocal{$_},";}; foreach (@resultsaqm){ print "$_:$cntaqm{$_},";};
+- print "localqueue=$localaqueue,remotequeue=$remoteaqueue\n";
+-# print join(':', map {$cntaqmlocal{$_}} @resultsaqm) .":". join(':', map {$cntaqm{$_}} @resultsaqm); print ":". $localaqueue .":". $remoteaqueue; print "\n";
++ foreach (keys %denied,@others){ debug "$_: $cnt{$_},";}; debug "\n";
++ # print join(':', map {$cnt{$_}} keys %denied,@others); print "\n";
++ debug "qmail ";
++ foreach (@resultsqm){ debug "local_$_:$cntqmlocal{$_},";}; foreach (@resultsqm){ debug "$_:$cntqm{$_},";};
++ debug "localqueue=$localqueue,remotequeue=$remotequeue\n";
++ # print join(':', map {$cntqmlocal{$_}} @resultsqm) .":". join(':', map {$cntqm{$_}} @resultsqm); print ":". $localqueue .":". $remotequeue; print "\n";
++ if (defined $localaqueue) {
++ debug("altqmail ");
++ foreach (@resultsaqm){ debug "local_$_:$cntaqmlocal{$_},";}; foreach (@resultsaqm){ debug "$_:$cntaqm{$_},";}; debug "\n";
++ debug("localqueue=$localaqueue,remotequeue=$remoteaqueue\n");
++ # print join(':', map {$cntaqmlocal{$_}} @resultsaqm) .":". join(':', map {$cntaqm{$_}} @resultsaqm); print ":". $localaqueue .":". $remoteaqueue; print "\n";
++ } else {
++ $localaqueue=""; $remoteaqueue="";
++ }
+
+ my %rrds=(
+ "sensors"=>"$sensors_temp1:$sensors_temp2:$sensors_temp_hd1:$sensors_temp_hd2:$sensors_fan_speed:$sensors_fan2_speed:$sensors_temp_hd3:$sensors_temp_hd4:$sensors_temp_hd5:$sensors_temp_hd6",
+diff -Nur --no-dereference smeserver-smeadmin-1.6.old/root/usr/lib/systemd/system/smeadmind.service smeserver-smeadmin-1.6/root/usr/lib/systemd/system/smeadmind.service
+--- smeserver-smeadmin-1.6.old/root/usr/lib/systemd/system/smeadmind.service 1969-12-31 19:00:00.000000000 -0500
++++ smeserver-smeadmin-1.6/root/usr/lib/systemd/system/smeadmind.service 2021-03-27 22:31:08.730000000 -0400
+@@ -0,0 +1,21 @@
++[Unit]
++Description=SME Admin Monitor Agent for Koozali SME Server
++Before=shutdown.target
++Conflicts=shutdown.target
++
++[Service]
++Type=forking
++Restart=no
++TimeoutSec=1min
++IgnoreSIGPIPE=no
++KillMode=process
++RemainAfterExit=yes
++
++PIDFile=/var/run/smeadmin.pid
++ExecStart=/usr/bin/smeadmind
++ExecReload=/usr/bin/kill -HUP $MAINPID
++Restart=always
++RestartSec=5
++
++[Install]
++WantedBy=sme-server.target