Skip to content

Commit 3170a1b

Browse files
author
Eric Wiseblatt
authored
Merge pull request #27 from ewiseblatt/post_install
Misc bug fixes:
2 parents 6b57e52 + 15abc58 commit 3170a1b

File tree

9 files changed

+89
-68
lines changed

9 files changed

+89
-68
lines changed

spinnaker-monitoring-daemon/bin/spinnaker-monitoring.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,4 @@
1515
# limitations under the License.
1616

1717
PYTHONWARNINGS=once \
18-
python $(dirname $0)/../spinnaker-monitoring \
19-
--log_dir /var/log/spinnaker/monitoring \
20-
"$@"
18+
python $(dirname $0)/../spinnaker-monitoring "$@"

spinnaker-monitoring-daemon/etc/init/spinnaker-monitoring.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ start on filesystem or runlevel [2345]
33
setuid spinnaker
44
setgid spinnaker
55

6-
exec /opt/spinnaker-monitoring/bin/spinnaker-monitoring.sh monitor > /var/log/spinnaker/monitoring/monitoring.log 2>&1
6+
exec /opt/spinnaker-monitoring/bin/spinnaker-monitoring.sh monitor 2>&1 > /var/log/spinnaker/monitoring/monitoring.log

spinnaker-monitoring-daemon/spinnaker-monitoring.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
# Each yaml file contains a "metrics_url:" value with either a URL string
33
# or a list of URL strings to collect from using the base filename as
44
# the identifier for the service the metrics came from.
5-
registry_dir: /opt/spinnaker-monitoring/registry
5+
# If not specified the default will be the first of:
6+
# ../registry, ../registry.dev, /opt/spinnaker-monitoring/registry
7+
registry_dir:
68

79
server:
810
# This host and port to bind the embedded HTTP server on.

spinnaker-monitoring-daemon/spinnaker-monitoring/__main__.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,40 @@ def init_logging(options):
5353
},
5454
'handlers':{
5555
'console':{
56-
'level':'WARNING',
56+
'level': options['log_level'],
5757
'class':'logging.StreamHandler',
5858
'formatter':'timestamped'
5959
},
60-
'file':{
61-
'level':'DEBUG',
62-
'class':'logging.FileHandler',
63-
'formatter':'timestamped',
64-
'filename': os.path.join(log_dir, log_file),
65-
'mode':'w'
66-
},
6760
},
6861
'loggers':{
6962
'': {
7063
'level':'DEBUG',
71-
'handlers':['console', 'file']
64+
'handlers':['console']
7265
},
7366
}
7467
}
68+
if log_dir:
69+
log_config['handlers']['file'] = {
70+
'level':'DEBUG',
71+
'class':'logging.FileHandler',
72+
'formatter':'timestamped',
73+
'filename': os.path.join(log_dir, log_file),
74+
'mode':'w'
75+
}
76+
log_config['loggers']['']['handlers'].append('file')
77+
7578
logging.config.dictConfig(log_config)
7679

7780

7881
def add_global_args(parser):
7982
"""Add global parser options that are independent of the command."""
80-
parser.add_argument('--log_basename', default='spinnaker-monitoring')
81-
parser.add_argument('--log_dir', default='.')
83+
parser.add_argument(
84+
'--log_basename', default='spinnaker-monitoring',
85+
help='When writing a logfile, use this as the basename (before .log extension)')
86+
parser.add_argument(
87+
'--log_dir', default=None,
88+
help='If specified, log to a --log_basename in this directory instead of console.')
89+
parser.add_argument('--log_level', default='INFO', help='log level to console')
8290
parser.add_argument('--config', default=DEFAULT_CONFIG_PATH,
8391
help='Path to base configuration directory.')
8492

spinnaker-monitoring-daemon/spinnaker-monitoring/spectator_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@ def get_source_catalog(options):
5050
Dictionary keyed by the root name of the config file in the registry
5151
directory whose value is the dictionary of the YAML file content.
5252
"""
53-
registry_dir = options.get('registry_dir', DEFAULT_REGISTRY_DIR)
53+
registry_dir = options.get('registry_dir') or DEFAULT_REGISTRY_DIR
5454
global _cached_registry_catalog
5555
global _cached_registry_timestamp
5656
try:
57+
5758
timestamp = os.path.getmtime(registry_dir)
5859
except OSError as err:
5960
logging.error(err)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
chown -R root:root /opt/spinnaker-monitoring/third_party

spinnaker-monitoring-third-party/third_party/datadog/install.sh

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,25 @@ DASHBOARDS=true
2222

2323
function process_args() {
2424
while [[ $# > 0 ]]; do
25-
local key="$1"
26-
shift
27-
case $key in
28-
--server_only)
29-
CLIENT=false
30-
DASHBOARDS=false
31-
;;
32-
--client_only)
33-
SERVER=false
34-
DASHBOARDS=false
35-
;;
36-
--dashboards_only)
37-
SERVER=false
38-
CLIENT=false
39-
;;
40-
esac
25+
local key="$1"
26+
shift
27+
case $key in
28+
--server_only)
29+
CLIENT=false
30+
DASHBOARDS=false
31+
;;
32+
--client_only)
33+
SERVER=false
34+
DASHBOARDS=false
35+
;;
36+
--dashboards_only)
37+
SERVER=false
38+
CLIENT=false
39+
;;
40+
*)
41+
echo "Unrecognized argument '$key'."
42+
exit -1
43+
esac
4144
done
4245
}
4346

@@ -93,7 +96,7 @@ function install_client() {
9396
fi
9497
}
9598

96-
process_args "$#"
99+
process_args "$@"
97100

98101

99102
if $SERVER; then

spinnaker-monitoring-third-party/third_party/prometheus/install.sh

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,29 @@ DASHBOARDS=true
2525

2626
function process_args() {
2727
while [[ $# > 0 ]]; do
28-
local key="$1"
29-
shift
30-
case $key in
31-
--gateway)
32-
GATEWAY_URL="$1"
33-
shift
34-
;;
35-
--server_only)
36-
CLIENT=false
37-
DASHBOARDS=false
38-
;;
39-
--client_only)
40-
SERVER=false
41-
DASHBOARDS=false
42-
;;
43-
--dashboards_only)
44-
SERVER=false
45-
CLIENT=false
46-
;;
47-
esac
28+
local key="$1"
29+
shift
30+
case $key in
31+
--gateway)
32+
GATEWAY_URL="$1"
33+
shift
34+
;;
35+
--server_only)
36+
CLIENT=false
37+
DASHBOARDS=false
38+
;;
39+
--client_only)
40+
SERVER=false
41+
DASHBOARDS=false
42+
;;
43+
--dashboards_only)
44+
SERVER=false
45+
CLIENT=false
46+
;;
47+
*)
48+
echo "Unrecognized argument '$key'."
49+
exit -1
50+
esac
4851
done
4952
}
5053

spinnaker-monitoring-third-party/third_party/stackdriver/install.sh

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,22 @@ function process_args() {
2323
local key="$1"
2424
shift
2525
case $key in
26-
--server_only)
27-
CLIENT=false
28-
DASHBOARDS=false
29-
;;
30-
--client_only)
31-
SERVER=false
32-
DASHBOARDS=false
33-
;;
34-
--dashboards_only)
35-
SERVER=false
36-
CLIENT=false
37-
;;
38-
esac
26+
--server_only)
27+
CLIENT=false
28+
DASHBOARDS=false
29+
;;
30+
--client_only)
31+
SERVER=false
32+
DASHBOARDS=false
33+
;;
34+
--dashboards_only)
35+
SERVER=false
36+
CLIENT=false
37+
;;
38+
*)
39+
echo "Unrecognized argument '$key'."
40+
exit -1
41+
esac
3942
done
4043
}
4144

@@ -71,7 +74,7 @@ function install_dashboards() {
7174
exit -1
7275
fi
7376

74-
for dashboard in '$DIRNAME"/*Dashboard.json; do
77+
for dashboard in "$DIRNAME"/*Dashboard.json; do
7578
"$DIRNAME/../../bin/spinnaker-monitoring.sh" \
7679
upload_stackdriver_dashboard --dashboard ${dashboard} \
7780
"$@"

0 commit comments

Comments
 (0)