add timestamp
This commit is contained in:
parent
e9e756ce8d
commit
b3c52a2a95
1 changed files with 4 additions and 2 deletions
|
@ -12,6 +12,7 @@ import json
|
|||
import click
|
||||
import click_config_file
|
||||
from logging.handlers import SysLogHandler
|
||||
import time
|
||||
|
||||
class restic_exporter:
|
||||
|
||||
|
@ -68,7 +69,9 @@ class restic_exporter:
|
|||
except Exception as error:
|
||||
self._log.error(f"# Error reading file '{json_file}'. Check permissions. {error}")
|
||||
|
||||
self.summary = {}
|
||||
self.summary = {
|
||||
"timestamp": time.time()
|
||||
}
|
||||
for line in content:
|
||||
try:
|
||||
line_data = json.loads(line)
|
||||
|
@ -142,7 +145,6 @@ class restic_exporter:
|
|||
case_sensitive=False,
|
||||
), help='Set the debug level for the standard output.')
|
||||
@click.option('--log-file', '-l', help="File to store all debug messages.")
|
||||
#@click.option("--dummy","-n" is_flag=True, help="Don't do anything, just show what would be done.") # Don't forget to add dummy to parameters of main function
|
||||
@click.option("--json-file", "-j", required=True, help='JSON file containing the output of restic')
|
||||
@click.option('--job-name', '-n', required=True, help='Restic job name to attach to the exported metrics')
|
||||
@click.option('--extra-labels', '-a', required=False, default=None, help='Pairs key=value separated by commas with extra labels to add to the summary')
|
||||
|
|
Loading…
Reference in a new issue