Re: Ceph mon leader oneliner?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 13/05/2015 09:35, Kai Storbeck wrote:
> Hello fellow Ceph admins,
> 
> I have a need to run some periodic scripts against my Ceph cluster.
> For example creating new snapshots or cleaning up old ones. I'd
> preferably want to configure this periodic artifact on all my
> monitors, but only execute it on the leader.
> 
> I've come up with the following oneliner:
> 
> ceph --admin-daemon /var/run/ceph/ceph-mon.*.asok mon_status | perl
> -MJSON -0e 'exit((from_json(<>))->{state} != "leader")'

What about:

eval state=$(ceph --admin-daemon /var/run/ceph/ceph-mon.*.asok mon_status | jq .state)

if test $state = leader ; then
  ...
fi

Cheers

> 
> 
> Has someone written up a quicker shortcut, preferably usable in bash?
> Or did someone solve this entirely different?
> 
> 
> 
> Thanks in advance!
> 
> Regards,
> Kai Storbeck
> 
> 
> 
> _______________________________________________
> ceph-users mailing list
> ceph-users@xxxxxxxxxxxxxx
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> 

-- 
Loïc Dachary, Artisan Logiciel Libre

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux