summaryrefslogtreecommitdiffstats
path: root/src/ps-ceph.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/ps-ceph.pl
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ps-ceph.pl')
-rwxr-xr-xsrc/ps-ceph.pl48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/ps-ceph.pl b/src/ps-ceph.pl
new file mode 100755
index 000000000..1e79e01a3
--- /dev/null
+++ b/src/ps-ceph.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+use strict;
+
+#
+# ps-ceph.pl: Displays a list of ceph processes running locally
+#
+# Copyright (C) 2010, Dreamhost
+#
+# This is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software
+# Foundation. See file COPYING.
+#
+
+sub is_ceph_proc {
+ my $cmdline = @_[0];
+ return 0 if $cmdline =~ /\bps-ceph.pl\b/;
+
+ return 1 if $cmdline =~ /\bceph\b/;
+ return 1 if $cmdline =~ /\bceph-fuse\b/;
+ return 1 if $cmdline =~ /\brbd-nbd\b/;
+ return 1 if $cmdline =~ /\brbd-fuse\b/;
+ return 1 if $cmdline =~ /\bceph-mds\b/;
+ return 1 if $cmdline =~ /\bceph-mon\b/;
+ return 1 if $cmdline =~ /\bceph-osd\b/;
+ return 1 if $cmdline =~ /\bceph-mgr\b/;
+ return 1 if $cmdline =~ /\brbd-mirror\b/;
+ return 1 if $cmdline =~ /\bradosgw\b/;
+ return 1 if $cmdline =~ /\bosdmaptool\b/;
+ return 1 if $cmdline =~ /\brados\b/;
+ return 1 if $cmdline =~ /test_/;
+ return 1 if $cmdline =~ /\bvstart.sh\b/;
+
+ return 0;
+}
+
+opendir PROC, "/proc";
+while(my $pid = readdir PROC) {
+ next if $pid =~ /\D/; # not a pid
+ next if !-o "/proc/$pid"; # not ours
+ open CMDLINE, "/proc/$pid/cmdline" or next;
+ my $cmdline = <CMDLINE>;
+ $cmdline =~ s/[^\x20-\x7e]/ /g;
+ close CMDLINE;
+ if (is_ceph_proc($cmdline)) {
+ print "$pid\t$cmdline\n";
+ }
+}