Skip to content

Commit 1c33e14

Browse files
set default filepath for monitoring config file
default fp is hardcoded to `monitoring.conf` and will be searched for in the current directory
1 parent 4e68140 commit 1c33e14

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

cloud-monitoring/cloudMonitoring/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def dispatch_command():
2020
"service-stats": service_stats_main,
2121
}
2222

23-
# Check that mandatory args passed - package, command, influx config filepath
24-
if len(sys.argv) < 3:
23+
# Check that mandatory args passed - package and command
24+
if len(sys.argv) < 2:
2525
print("Usage: monitoring <command> <config-filpath> [args...]", file=sys.stderr)
2626
print(f"Available commands: {', '.join(commands.keys())}", file=sys.stderr)
2727
return 1

cloud-monitoring/cloudMonitoring/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import configparser
23
from configparser import ConfigParser
34
from typing import Dict, Tuple, Callable
@@ -61,7 +62,11 @@ def parse_args(inp_args, description: str = "scrape metrics script") -> Dict:
6162

6263
parser = argparse.ArgumentParser(description=description)
6364
parser.add_argument(
64-
"config_filepath", type=Path, help="Path to monitoring config file"
65+
"config_filepath",
66+
type=Path,
67+
help="Path to monitoring config file",
68+
nargs='?',
69+
default=Path(os.getcwd()) / "monitoring.conf"
6570
)
6671
try:
6772
args = parser.parse_args(inp_args)

0 commit comments

Comments
 (0)