Hi, I do something like this to have a complete output of lib/drive/path/state :
SELECT
CASE
WHEN paths.online = 'YES' THEN '<span class=\"ok\">ONLINE</span>'
WHEN paths.online = 'NO' THEN '<span class=\"warn\">OFFLINE</span>'
END as PATHSTATE,
CASE
WHEN drives.online = 'YES' THEN '<span class=\"ok\">OK</span>'
WHEN drives.online != 'YES' THEN '<span class=\"warn\">ERROR</span>'
END as DRIVESTATE,
paths.destination_type, paths.library_name, paths.destination_name,
CASE
WHEN drives.drive_state = 'LOADED' THEN 'LOADED'
WHEN drives.drive_state = 'EMPTY' THEN '<span class=\"emph\">EMPTY</span>'
END as DRIVE_STATE,
CASE
WHEN drives.drive_state = 'LOADED' THEN '<span class=\"emph\">' || drives.volume_name || '</span>'
WHEN drives.drive_state = 'EMPTY' THEN '-'
END as LOADED_VOL,
drives.drive_serial, paths.device
FROM paths, drives
where paths.destination_name = drives.drive_name
order by drives.drive_serial
The output, in my case, goes into a csv file I load into a webpage (like a dashboard for various things I want to see on my Spectrum Protect server), updating every 5 min. The span class... help to color the output on the website green/red according if all is good or some error comes up.
Hope this helps.
Cheers, Igor
