Skip to content

Commit

Permalink
Merge pull request #1 from hanzhongzi/master
Browse files Browse the repository at this point in the history
Solve the situation that sometimes the password is filled in the sentinel configuration file
  • Loading branch information
tokheim authored Oct 22, 2021
2 parents 78b6bb9 + e8f2a54 commit cdbf995
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Name | Description | Default
-H --host | The host sentinel is running on | localhost
-i --scrape-interval-seconds | How often to update the underlying metrics in seconds | 30
-m --metrics-port | The port that the metrics exporter will listen on | 9478

-P --password | The password that the metrics exporter will connect in sentinle | " "
3 changes: 2 additions & 1 deletion sentinel_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
parser.add_argument('-H', '--host', type=str, default="localhost")
parser.add_argument('-i', '--scrape-interval-seconds', type=int, default=30)
parser.add_argument('-m', '--metrics-port', type=int, default=9478)
parser.add_argument('-P', '--password', type=str, default="")
parser.add_argument('--debug', action="store_true")
args = parser.parse_args()

Expand Down Expand Up @@ -48,7 +49,7 @@ def update_metrics(self):
def main():
start_http_server(args.metrics_port)
log.info("Connecting to sentinel on %s:%s", args.host, args.port)
redis_client = Redis(host=args.host, port=args.port)
redis_client = Redis(host=args.host, port=args.port, password=args.password)
run_exporter(redis_client, args.scrape_interval_seconds)

def run_exporter(redis_client, sleeptime):
Expand Down

0 comments on commit cdbf995

Please sign in to comment.