[pmon] move platform monitor docker to stretch (#2680)

Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
This commit is contained in:
Mykola F 2019-03-23 01:42:56 +02:00 committed by lguohan
parent e06e7dc007
commit 3826ffd30f
7 changed files with 316 additions and 8 deletions

2
.gitignore vendored
View File

@ -27,6 +27,8 @@ src/libteam/*
src/lldpd/*
!src/lldpd/Makefile
!src/lldpd/patch/
src/lm-sensors/*
!src/lm-sensors/Makefile
src/mpdecimal/*
!src/mpdecimal/Makefile
src/python-click/*

View File

@ -1,4 +1,4 @@
FROM docker-config-engine
FROM docker-config-engine-stretch
ARG docker_container_name
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
@ -6,11 +6,8 @@ RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%s
# Make apt-get non-interactive
ENV DEBIAN_FRONTEND=noninteractive
# Update apt's cache of available packages
RUN apt-get update
# Install required packages
RUN apt-get install -y python-pip libpython2.7 sensord fancontrol ipmitool
RUN apt-get update && apt-get install -y python-pip libpython2.7 ipmitool librrd8 librrd-dev rrdtool
{% if docker_platform_monitor_debs.strip() -%}
# Copy locally-built Debian package dependencies

View File

@ -2,13 +2,14 @@
DOCKER_PLATFORM_MONITOR = docker-platform-monitor.gz
$(DOCKER_PLATFORM_MONITOR)_PATH = $(DOCKERS_PATH)/docker-platform-monitor
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
$(DOCKER_PLATFORM_MONITOR)_DEPENDS += $(LM_SENSORS) $(LIBSWSSCOMMON) $(PYTHON_SWSSCOMMON)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_DEBS += $(SONIC_LEDD) $(SONIC_XCVRD) $(SONIC_PSUD)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SWSSSDK_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_PLATFORM_API_PY2)
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_DAEMON_BASE_PY2)
$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE)
$(DOCKER_PLATFORM_MONITOR)_LOAD_DOCKERS = $(DOCKER_CONFIG_ENGINE_STRETCH)
SONIC_STRETCH_DOCKERS += $(DOCKER_PLATFORM_MONITOR)
SONIC_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_PLATFORM_MONITOR)

26
rules/lm-sensors.mk Normal file
View File

@ -0,0 +1,26 @@
# lm-senensors package
LM_SENSORS_VERSION=3.4.0
LM_SENSORS_VERSION_FULL=$(LM_SENSORS_VERSION)-4
LM_SENSORS = lm-sensors_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(LM_SENSORS)_SRC_PATH = $(SRC_PATH)/lm-sensors
FANCONTROL = fancontrol_$(LM_SENSORS_VERSION_FULL)_all.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(FANCONTROL)))
LIBSENSORS = libsensors4_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(LIBSENSORS)))
SENSORD = sensord_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(eval $(call add_derived_package,$(LM_SENSORS),$(SENSORD)))
$(SENSORD)_DEPENDS += $(LIBSENSORS) $(LM_SENSORS)
SONIC_MAKE_DEBS += $(LM_SENSORS)
export LM_SENSORS
export FANCONTROL
export LIBSENSORS
export SENSORD
export LM_SENSORS_VERSION
export LM_SENSORS_VERSION_FULL

View File

@ -213,7 +213,11 @@ RUN apt-get update && apt-get install -y \
python3-pytest \
python3-colorama \
# For initramfs
bash-completion
bash-completion \
# For lm-sensors
librrd8 \
librrd-dev \
rrdtool
# For linux build
RUN apt-get -y build-dep linux

View File

@ -0,0 +1,257 @@
From a8047116d3724bf77cb4306f0440ea62f0a453ca Mon Sep 17 00:00:00 2001
From: Mykola Faryma <mykolaf@mellanox.com>
Date: Tue, 19 Mar 2019 14:41:15 +0000
Subject: [PATCH] patch the debian package info to get sensord
Signed-off-by: Mykola Faryma <mykolaf@mellanox.com>
---
.../lm-sensors-3.4.0/debian/sensord.NEWS | 12 ++++
.../lm-sensors-3.4.0/debian/sensord.README.Debian | 23 ++++++++
.../lm-sensors-3.4.0/debian/sensord.default | 20 +++++++
.../lm-sensors-3.4.0/debian/sensord.dirs | 3 +
.../lm-sensors-3.4.0/debian/sensord.init | 64 ++++++++++++++++++++++
.../lm-sensors-3.4.0/debian/sensord.install | 2 +
.../lm-sensors-3.4.0/debian/sensord.maintscript | 2 +
.../lm-sensors-3.4.0/debian/sensord.postinst | 23 ++++++++
.../lm-sensors-3.4.0/debian/sensord.substvars | 2 +
src/lm-sensors/lm-sensors_3.4.0-4.dsc | 3 +-
10 files changed, 153 insertions(+), 1 deletion(-)
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.NEWS
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.README.Debian
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.default
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.dirs
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.init
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.install
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.maintscript
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.postinst
create mode 100644 src/lm-sensors/lm-sensors-3.4.0/debian/sensord.substvars
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.NEWS b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.NEWS
new file mode 100644
index 0000000..4bcfdb9
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.NEWS
@@ -0,0 +1,12 @@
+lm-sensors (1:2.9.0-7) unstable; urgency=low
+
+ Since version 2.9.0 sensord doesn't scale the loadavg itself (* 10) as
+ RRDs work with floating-point values and thus do very well with
+ non-integer values even < 1.
+
+ They can even be scaled later at display time by rrdtool itself using:
+ DEF:load=sensord.rrd:loadavg:AVERAGE
+ CDEF:load10=load,10,*
+
+ -- Aurelien Jarno <aurel32@debian.org> Tue, 11 Jan 2005 22:41:34 +0100
+
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.README.Debian b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.README.Debian
new file mode 100644
index 0000000..9159fbc
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.README.Debian
@@ -0,0 +1,23 @@
+This is the Debian packaging of sensord, the sensord logging daemon.
+
+The file /etc/default/sensord specifies the configuration parameters
+used to start the daemon. In particular, the syslog facility is set
+to `daemon' and not `local4'.
+
+You must load the appropriate lm-sensors modules during system boot in
+order for the daemon to function correctly.
+
+The file /etc/modules is a useful place to list these modules; for
+example, you might list i2c-amd756 (an I2C/SMBUS module) and w83781d
+(a sensor chip module).
+
+The daemon does not setup the sensors limits from /etc/sensors3.conf,
+this is the job of sensors, when called with -s. Note that 'sensors -s'
+is called at boot time from /etc/init.d/lm-sensors, so that the sensors
+limits should be the right ones in normal use. Don't forget to run
+sensors -s again if you changed the limits in /etc/sensors3.conf.
+
+For full documentation on setting up lm-sensors on your system,
+see /usr/share/doc/lm-sensors.
+
+-- David Z. Maze <dmaze@debian.org>
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.default b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.default
new file mode 100644
index 0000000..589b94c
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.default
@@ -0,0 +1,20 @@
+# Interval between scanning for alarms; e.g., 30s, 1m, 1h
+# ALARM_INTERVAL=1m
+# Interval between logging sensor measurements; e.g., 30s, 1m, 1h
+# LOG_INTERVAL=30m
+# Syslog facility to use
+SYSLOG_FACILITY=daemon
+# Libsensors config file to use
+# CONFIG_FILE=/etc/sensors3.conf
+# Chips to scan
+# SCAN_CHIPS=...
+
+# Uncomment this to enable a 7-day round-robin database of sensor
+# readings. See the ROUND ROBIN DATABASES section of the sensord
+# manual page for details.
+# RRD_FILE=/var/log/sensord.rrd
+# Interval between RRD readings; e.g. 30s, 5m (default), 1h
+# RRD_INTERVAL=5m
+# Include the load average in the RRD file. If you enable this you
+# must remove your old RRD file and rebuild your CGI script.
+# RRD_LOADAVG=yes
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.dirs b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.dirs
new file mode 100644
index 0000000..b9cd814
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.dirs
@@ -0,0 +1,3 @@
+usr/sbin
+usr/share/man/man8
+etc/default
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.init b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.init
new file mode 100644
index 0000000..4d70d43
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.init
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides: sensord
+# Required-Start: $remote_fs $syslog lm-sensors
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: lm-sensors daemon
+# Description: hardware sensor information logging daemon
+### END INIT INFO
+
+. /lib/lsb/init-functions
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+DAEMON=/usr/sbin/sensord
+DESC="sensor daemon"
+NAME="sensord"
+PIDFILE=/var/run/sensord.pid
+CONFIG=/etc/default/sensord
+
+test -x $DAEMON || exit 0
+
+if [ -f $CONFIG ]; then . $CONFIG; fi
+
+if [ -n "$ALARM_INTERVAL" ]; then ALARM_INTERVAL="-i $ALARM_INTERVAL"; fi
+if [ -n "$LOG_INTERVAL" ]; then LOG_INTERVAL="-l $LOG_INTERVAL"; fi
+if [ -n "$SYSLOG_FACILITY" ]; then SYSLOG_FACILITY="-f $SYSLOG_FACILITY"; fi
+if [ -n "$CONFIG_FILE" ]; then CONFIG_FILE="-c $CONFIG_FILE"; fi
+if [ -n "$RRD_FILE" ]; then RRD_FILE="-r $RRD_FILE"; fi
+if [ -n "$RRD_INTERVAL" ]; then RRD_INTERVAL="-t $RRD_INTERVAL"; fi
+if [ -n "$RRD_LOADAVG" ]; then RRD_LOADAVG="-a"; fi
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting $DESC" "$NAME"
+ /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $ALARM_INTERVAL $LOG_INTERVAL $SYSLOG_FACILITY $RRD_INTERVAL $RRD_FILE $RRD_LOADAVG $CONFIG_FILE $SCAN_CHIPS
+ log_end_msg $?
+ ;;
+ stop)
+ log_daemon_msg "Stopping $DESC" "$NAME"
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --exec $DAEMON
+ log_end_msg $?
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ force-reload)
+ if start-stop-daemon --stop --test --quiet --pidfile $PIDFILE --exec $DAEMON ; then
+ $0 restart
+ fi
+ ;;
+ status)
+ status_of_proc $DAEMON $NAME && exit 0 || exit $?
+ ;;
+ *)
+ echo "Usage: /etc/init.d/sensord {start|stop|restart|force-reload|status}"
+ exit 1
+esac
+
+exit 0
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.install b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.install
new file mode 100644
index 0000000..9713fee
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.install
@@ -0,0 +1,2 @@
+usr/sbin/sensord
+usr/share/man/man8/sensord.8
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.maintscript b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.maintscript
new file mode 100644
index 0000000..0e0ff03
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.maintscript
@@ -0,0 +1,2 @@
+# Remove old logcheck ignore file
+rm_conffile /etc/logcheck/ignore.d.server/sensord 1:3.3.5-1~
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.postinst b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.postinst
new file mode 100644
index 0000000..3418fa6
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.postinst
@@ -0,0 +1,23 @@
+#!/bin/sh
+# postinst script for sensord
+#
+# see: dh_installdeb(1)
+set -e
+
+case "$1" in
+ configure)
+ # Remove shutdown and reboot links; this init script does not need them.
+ if dpkg --compare-versions "$2" lt "1:3.1.1-5"; then
+ rm -f /etc/rc0.d/K[0-9][0-9]sensord /etc/rc1.d/K[0-9][0-9]sensord /etc/rc6.d/K[0-9][0-9]sensord
+ fi
+ ;;
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
diff --git a/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.substvars b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.substvars
new file mode 100644
index 0000000..978fc8b
--- /dev/null
+++ b/src/lm-sensors/lm-sensors-3.4.0/debian/sensord.substvars
@@ -0,0 +1,2 @@
+misc:Depends=
+misc:Pre-Depends=
diff --git a/src/lm-sensors/lm-sensors_3.4.0-4.dsc b/src/lm-sensors/lm-sensors_3.4.0-4.dsc
index 6674f1c..2aeab21 100644
--- a/src/lm-sensors/lm-sensors_3.4.0-4.dsc
+++ b/src/lm-sensors/lm-sensors_3.4.0-4.dsc
@@ -3,7 +3,7 @@ Hash: SHA512
Format: 3.0 (quilt)
Source: lm-sensors
-Binary: lm-sensors, libsensors4, libsensors4-dev, fancontrol
+Binary: lm-sensors, libsensors4, libsensors4-dev, fancontrol, sensord
Architecture: any all
Version: 1:3.4.0-4
Maintainer: Aurelien Jarno <aurel32@debian.org>
@@ -15,6 +15,7 @@ Package-List:
libsensors4 deb libs optional arch=any
libsensors4-dev deb libdevel extra arch=any
lm-sensors deb utils extra arch=linux-any
+ sensord deb utils extra arch=any
Checksums-Sha1:
3e245b61a69756ea94f9c8a7c7614ec543970b8c 175802 lm-sensors_3.4.0.orig.tar.bz2
bc5f40b504a908d825ca22da461e673dc8f7c026 26436 lm-sensors_3.4.0-4.debian.tar.xz
--
1.9.1

21
src/lm-sensors/Makefile Normal file
View File

@ -0,0 +1,21 @@
SHELL = /bin/bash
.ONESHELL:
.SHELLFLAGS += -e
MAIN_TARGET = $(LM_SENSORS)
DERIVED_TARGETS = fancontrol_$(LM_SENSORS_VERSION_FULL)_all.deb \
libsensors4_$(LM_SENSORS_VERSION_FULL)_amd64.deb \
sensord_$(LM_SENSORS_VERSION_FULL)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf lm-sensors-$(LM_SENSORS_VERSION)
dget -u http://deb.debian.org/debian/pool/main/l/lm-sensors/lm-sensors_3.4.0-4.dsc
git am *.patch
pushd lm-sensors-$(LM_SENSORS_VERSION)
DEB_BUILD_OPTIONS=nocheck PROG_EXTRA=sensord dpkg-buildpackage -us -uc -b -j$(SONIC_CONFIG_MAKE_JOBS)
popd
mv $* $(DEST)/
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)