shell prompt that shows coloured ceph status

kmonti

New Member
Aug 15, 2024
10
1
3
I created simple prompt that shows coloured ceph status and you can include in your ~/.bashrc:
Bash:
ceph_status() { ceph health | awk '/HEALTH_OK/ {print "\033[32m" $0 "\033[0m"}; /HEALTH_ERR/ {print "\033[31m" $0 "\033[0m"}; /HEALTH_WARN/ {print "\033[33m" $0 "\033[0m"}'; }
PS1='$(ceph_status)\n[\u@\h \W]\$ '


It will show status in:
green if HEALTH__OK
red if HEALTH_ERR
yellow if HEALTH_WARN

as shown on attachment.
 

Attachments

  • Zrzut ekranu z 2024-08-25 13-19-07.png
    Zrzut ekranu z 2024-08-25 13-19-07.png
    20.2 KB · Views: 10
  • Like
Reactions: waltar
Luckily this was just a shell prompt test in picture with 6 daemon recently crashed ... but nice idea :)