Changes to launching the python.d plugin aggregator. (#6781)
* Changes to launching the python.d plugin aggregator. Passing python.d arguments from netdata.conf Path to the specific python interpreter can be passed on the command-line. Reused existing configuration options, changed the plugin script to match. To specify a python binary use the -p switch. The existing pythond options can be passed in, for example: [plugin:python.d] command options = -p/usr/local/bin/python2.7 trace debug
Andrew Moss committed
Sep 17, 2019 at 15:42 UTC
e3a3b381d6a24239f998db785f4de1d55c1625a8
1 file changed
+16
-2
collectors/python.d.plugin/python.d.plugin.in
+16
-2
@@ -1,7 +1,21 @@
1
#!/usr/bin/env bash
2
'''':;
3
-exec "$(command -v python || command -v python3 || command -v python2 ||
4
-echo "ERROR python IS NOT AVAILABLE IN THIS SYSTEM")" "$0" "$@" # '''
3
+pybinary=$(which python || which python3 || which python2)
4
+filtered=()
5
+for arg in "$@"
6
+do
7
+ case $arg in
8
+ -p*) pybinary=${arg:2}
9
+ shift 1 ;;
10
+ *) filtered+=("$arg") ;;
11
+ esac
12
+done
13
+if [ "$pybinary" = "" ]
14
+then
15
+ echo "ERROR python IS NOT AVAILABLE IN THIS SYSTEM"
16
+ exit 1
17
+fi
18
+exec "$pybinary" "$0" "${filtered[@]}" # '''
19
20
# -*- coding: utf-8 -*-
21
# Description: