Created
August 17, 2018 20:46
-
-
Save abassanini/2c07dbf4a3e55ecbdc1c924381e2b7f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import argparse | |
| import datetime | |
| import time | |
| def valid_date(s): | |
| try: | |
| return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M") | |
| except ValueError: | |
| msg = "Not a valid date: '{0}'.".format(s) | |
| raise argparse.ArgumentTypeError(msg) | |
| parser = argparse.ArgumentParser(description='ACK problems in zabbix via API') | |
| parser.add_argument("-s", | |
| "--startdate", | |
| help="The Start Date - format 'YYYY-MM-DD HH:MM'", | |
| required=True, | |
| type=valid_date) | |
| args = parser.parse_args() | |
| print time.mktime(args.startdate.timetuple()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment