Commit 97b7d50a authored by Francklin Simo's avatar Francklin Simo

Fix opensand-collector

parent 47a89799
......@@ -9,14 +9,15 @@ Standards-Version: 3.8.3
Section: misc
Package: opensand-collector
Architecture: any
Section: misc
Architecture: any
Depends: ${misc:Depends}, python (>= 2.7), python (<<3.0),
python-dbus,
python-avahi, avahi-daemon,
rsyslog, logrotate
rsyslog, logrotate, curl,
elasticsearch (= 6.2.4), influxdb (= 1.7.1-1),
openjdk-8-jdk, logstash (= 1:6.2.4-1)
Provides: opensand-env-plane
Conflicts: opensand-env-plane
Replaces: opensand-env-plane
Description: Statistics and events collector for OpenSAND
......@@ -20,6 +20,14 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
create_opensand_db(){
db_get opensand-collector/influxdb/port
INFLUXDB_PORT="${RET}"
echo "Waiting for influxdb starts to accepting requests..."
timeout 120 bash -c "until echo > /dev/tcp/localhost/${INFLUXDB_PORT}; do sleep 0.5; done" > /dev/null 2>&1
curl -i -XPOST http://localhost:${INFLUXDB_PORT}/query --data-urlencode "q=CREATE DATABASE opensand"
}
create_elasticsearch_conf(){
db_get opensand-collector/elasticsearch/port
ELASTICSEARCH_PORT="${RET}"
......@@ -27,7 +35,7 @@ create_elasticsearch_conf(){
cat << EOF > "${CONFIG_FILE}"
path.data: /var/lib/elasticsearch
path.log: /var/log/elasticsearch
path.logs: /var/log/elasticsearch
cluster.name: "opensand"
node.name: "collector"
network.host: 0.0.0.0
......@@ -69,7 +77,7 @@ filter {
remove_field => [ "@version", "host", "tags", "type", "port" ]
}
if ("[DEBUG]" in [message] or "[INFO]" in [message] or "[NOTICE]" in [message] or "[WARNING]" in [message] or "[ERROR]" in [message] or "[CRITICAL]" in [message]) {
if ("[EVENT]" in [message] or "[DEBUG]" in [message] or "[INFO]" in [message] or "[NOTICE]" in [message] or "[WARNING]" in [message] or "[ERROR]" in [message] or "[CRITICAL]" in [message]) {
dissect {
mapping => { "message" => "[%{timestamp}][%{log_level}][%{log_name}]%{log_message}" }
convert_datatype => { "timestamp" => "int" }
......@@ -99,14 +107,18 @@ end'
}
date {
match => [ "timestamp", "UNIX_MS" ]
match => [ "timestamp", "UNIX_MS", "yyyy-MM-dd HH:mm:ss.SSS" ]
remove_field => [ "timestamp" ]
}
mutate {
remove_field => [ "tags" ]
}
}
output {
if "message" in event.fields {
elasticserach {
if ("" in [message]) {
elasticsearch {
hosts => "localhost:${ELASTICSEARCH_PORT}"
}
} else {
......@@ -117,7 +129,7 @@ output {
port => ${INFLUXDB_PORT}
db => "opensand"
time_precision => "ms"
retention_policy => "opensand"
retention_policy => "autogen"
}
}
}
......@@ -148,6 +160,7 @@ case "$1" in
create_logstash_conf
install_logstash_plugin
restart_services
create_opensand_db
;;
abort-upgrade|abort-remove|abort-deconfigure)
......
......@@ -40,7 +40,7 @@ stop_services(){
case "$1" in
purge)
stop_services
remove_syslog_conf
remove_config_files
;;
remove)
......
......@@ -22,14 +22,14 @@ Type: string
Default: 5361
Description: Statistics Port
Port that Logstash will use to listen to incomming
statistics from OpenSAND binaries.
statistics from SATCOM Components.
Template: opensand-collector/collector/logs/port
Type: string
Default: 5362
Description: Logs Port
Port that Logstash will use to listen to incomming
logs from OpenSAND binaries.
logs from SATCOM components.
Template: opensand-collector/elasticsearch/port
Type: string
......
opensand-conf (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-conf (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-core (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-core (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-daemon (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-daemon (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-manager (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-manager (5.1.2) xenial; urgency=low
* Release 5.1.2
......
#!/bin/sh -e
# Source debconf library.
. /usr/share/debconf/confmodule
usage(){
/bin/echo -e "Usage: $0 command\n\twith command: configure or reconfigure"
}
configure(){
STATE=1
while true; do
case "$STATE" in
1)
db_beginblock
db_input high opensand-manager/collector/ip || true
;;
2)
db_input high opensand-manager/collector/stats/port || true
;;
3)
db_input high opensand-manager/collector/logs/port || true
db_endblock
;;
*)
# The default case catches when $STATE is greater than the
# last implemented state, and breaks out of the loop. This
# requires that states be numbered consecutively from 1
# with no gaps, as the default case will also be entered
# if there is a break in the numbering
break # exits the enclosing "while" loop
;;
esac
if db_go; then
STATE=$(($STATE + 1))
else
STATE=$(($STATE - 1))
fi
done
if [ $STATE -eq 0 ]; then
# The user has asked to back up from the first
# question. This case is problematical. Regular
# dpkg and apt package installation isn’t capable
# of backing up questions between packages as this
# is written, so this will exit leaving the package
# unconfigured - probably the best way to handle
# the situation.
exit 10
fi
}
unseen(){
db_fset opensand-manager/collector/ip seen false
db_fset opensand-manager/collector/stats/port seen false
db_fset opensand-manager/collector/logs/port seen false
}
db_capb backup
if [ "$#" -gt 0 ]; then
if [ "$1" = "configure" ]; then
configure
elif [ "$1" = "reconfigure" ]; then
unseen
configure
else
usage
exit 1
fi
else
usage
fi
exit 0
......@@ -5,6 +5,9 @@
set -e
# Source debconf library.
. /usr/share/debconf/confmodule
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
......@@ -18,8 +21,26 @@ set -e
# the debian-policy package
update_start_cmd() {
SOURCE_FILE="/usr/lib/python2.7/dist-packages/opensand_manager_core/controller/machine.py"
db_get opensand-manager/collector/ip
COLLECTOR_IP="${RET}"
db_get opensand-manager/collector/stats/port
COLLECTOR_STATS_PORT="${RET}"
db_get opensand-manager/collector/logs/port
COLLECTOR_LOGS_PORT="${RET}"
# Update stat command, indent adding espace
START_CMD=" command_line += \" -f '/var/log/opensand/' -r ${COLLECTOR_IP} -l ${COLLECTOR_LOGS_PORT} -s ${COLLECTOR_STATS_PORT}\""
# Comment lines 278-283
sed -e '278,283s/^#*/#/g' -i ${SOURCE_FILE}
# Replace line 277 by start_cmd
sed -i "277s|^.*$|${START_CMD}|" ${SOURCE_FILE}
}
case "$1" in
configure)
update_start_cmd
;;
abort-upgrade|abort-remove|abort-deconfigure)
......
Template: opensand-manager/collector/ip
Type: string
Default: localhost
Description: Collector IP
Address of the collector so SATCOM components can forward statistics
and logs.
Template: opensand-manager/collector/stats/port
Type: string
Default: 5361
Description: Statistics Port
Port of the Collector that Logstash uses to listen to incomming
statistics from SATCOM components.
Template: opensand-manager/collector/logs/port
Type: string
Default: 5362
Description: Logs Port
Port of the Collector that Logstash uses to listen to incomming
logs from SATCOM components.
opensand-meta (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-meta (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-network (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-network (5.1.2) xenial; urgency=low
* Release 5.1.2
......
File mode changed from 100644 to 100755
opensand-output (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-output (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-gse-encap-plugin (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-gse-encap-plugin (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-rle-encap-plugin (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-rle-encap-plugin (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-rohc-lan-adapt-plugin (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-rohc-lan-adapt-plugin (5.1.2) xenial; urgency=low
* Release 5.1.2
......
opensand-rt (5.2.0) xenial; urgency=low
* Release 5.2.0
-- mettinger <mathias.ettinger@viveris.fr> Tue, 19 Mar 2020 15:00:00 +0200
opensand-rt (5.1.2) xenial; urgency=low
* Release 5.1.2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment