]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/perl |
2 | use strict; | |
3 | ||
4 | # | |
5 | # ps-ceph.pl: Displays a list of ceph processes running locally | |
6 | # | |
7 | # Copyright (C) 2010, Dreamhost | |
8 | # | |
9 | # This is free software; you can redistribute it and/or | |
10 | # modify it under the terms of the GNU Lesser General Public | |
11 | # License version 2.1, as published by the Free Software | |
12 | # Foundation. See file COPYING. | |
13 | # | |
14 | ||
15 | sub is_ceph_proc { | |
16 | my $cmdline = @_[0]; | |
17 | return 0 if $cmdline =~ /\bps-ceph.pl\b/; | |
18 | ||
19 | return 1 if $cmdline =~ /\bceph\b/; | |
20 | return 1 if $cmdline =~ /\bceph-fuse\b/; | |
21 | return 1 if $cmdline =~ /\brbd-nbd\b/; | |
22 | return 1 if $cmdline =~ /\brbd-fuse\b/; | |
23 | return 1 if $cmdline =~ /\bceph-mds\b/; | |
24 | return 1 if $cmdline =~ /\bceph-mon\b/; | |
25 | return 1 if $cmdline =~ /\bceph-osd\b/; | |
26 | return 1 if $cmdline =~ /\bceph-mgr\b/; | |
27 | return 1 if $cmdline =~ /\bceph-disk\b/; | |
28 | return 1 if $cmdline =~ /\brbd-mirror\b/; | |
29 | return 1 if $cmdline =~ /\bradosgw\b/; | |
30 | return 1 if $cmdline =~ /\bosdmaptool\b/; | |
31 | return 1 if $cmdline =~ /\brados\b/; | |
32 | return 1 if $cmdline =~ /test_/; | |
33 | return 1 if $cmdline =~ /\bvstart.sh\b/; | |
34 | ||
35 | return 0; | |
36 | } | |
37 | ||
38 | opendir PROC, "/proc"; | |
39 | while(my $pid = readdir PROC) { | |
40 | next if $pid =~ /\D/; # not a pid | |
41 | next if !-o "/proc/$pid"; # not ours | |
42 | open CMDLINE, "/proc/$pid/cmdline" or next; | |
43 | my $cmdline = <CMDLINE>; | |
44 | $cmdline =~ s/[^\x20-\x7e]/ /g; | |
45 | close CMDLINE; | |
46 | if (is_ceph_proc($cmdline)) { | |
47 | print "$pid\t$cmdline\n"; | |
48 | } | |
49 | } |