Hi folks!!

I have a script in python to get a number of jobs in Warning and Error, but 
when i try to execute the script, for example: python testing_script.py 
get_error_jobs, hes show me this error:

   File 
"/usr/lib/python3.9/site-packages/bareos/bsock/directorconsolejson.py", 
line 93, in call
    raise bareos.exceptions.JsonRpcErrorReceivedException(json)
bareos.exceptions.JsonRpcErrorReceivedException: failed: .sql: is an 
invalid command.

The function from script is:

def get_error_jobs(args):
    console = create_console()
    error_jobs = console.call('.sql query="SELECT COUNT(Job) FROM Job where 
jobstatus=\'E\' AND starttime >= current_date - INTERVAL \'1 days\';"')
    try:
        print((error_jobs["query"][0]["count"]))
    except KeyError:
        print(0)

I execute directly this comand (.sql query="SELECT COUNT(Job) FROM Job 
where jobstatus=\'E\' AND starttime >= current_date - INTERVAL \'1 days\';) 
in the bconsole, and hes works fine.

Has anyone experienced this problem?

-- 
You received this message because you are subscribed to the Google Groups 
"bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bareos-users/ca42ebd4-19b8-4de3-a855-0160ad718700n%40googlegroups.com.

Reply via email to