Here's what I use. It's more for showing me the date, duration, and backup
size than backup status, but it can be modified to show all statuses:
SELECT jobid, name, s.jobstatuslong as status, to_char(endtime::date,
'YYYY-MM-DD') as last_successful, to_char(date_part('epoch', endtime -
starttime) * interval '1 second', 'HH24:MI:SS') as duration, jobfiles,
jobbytes::bigint as size
FROM job
JOIN status s USING (jobstatus)
WHERE level = 'F'
AND jobstatus IN ('T', 'W')
ORDER BY last_successful desc;
In the WHERE clause:
level = 'F' - only show full backups
jobstatus IN ('T', 'W') - only show me successful and warning jobs. Take
this out to see all statuses
Hope that helps
On Friday, September 1, 2023 at 11:14:49 AM UTC Tihomir Vlahovski wrote:
> I was planning the same and my idea was to use the API -
> https://docs.bareos.org/DeveloperGuide/api.html#
> Still on my TODO list though
>
> Cheers,
> -Tiho
>
> On Tuesday, August 22, 2023 at 11:58:57 AM UTC+3 Bruno Friedmann wrote:
>
>> I'm not sure to have 100% understood what you're looking for, if it is
>> about finished jobs (then search in the database is fine) or actually
>> running, planned and so on, which are only known by the director and are
>> lost if there's a crash.
>>
>>
>> On Monday, August 21, 2023 at 11:10:06 AM UTC+2 Guy Van Sanden wrote:
>>
>>> Can I get the status of jobs from the database directly?
>>> I'm rebuilding my Zabbix template to monitor bareos jobs, but that part
>>> is missing.
>>>
>>> I have this currently
>>>
>>> jobquery = "select distinct name from job where type = 'B' and clientid
>>> in (select clientid from client where jobretention <> 0);"
>>> -> gets the jobs
>>>
>>> for job in jobs:
>>> statusquery = ("select * from job where name = '%s' order by endtime
>>> desc" %(job['name']))
>>>
>>>
--
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/c5c26210-dff8-408e-8073-70176103233fn%40googlegroups.com.