Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microceph][ubuntu] Add changes for microceph collections #3291

Merged
merged 1 commit into from
Jul 18, 2023
Merged

[microceph][ubuntu] Add changes for microceph collections #3291

merged 1 commit into from
Jul 18, 2023

Conversation

nkshirsagar
Copy link
Contributor

@nkshirsagar nkshirsagar commented Jun 28, 2023

Add a new plugin to enable collecting Ubuntu microceph data


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname [email protected]?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-3291
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@jcastill
Copy link
Member

  • Please fix the flake8 style warnings and error as per the Flake8 test.

  • Regarding 'all_logs' var: I think you need to define what's all logs, and use the variable to select the actual logs you'll need for this specific plugin. See places like salt.py or ubuntu.py for examples. In ubuntu.py you can see how you can actually omit defining the var by calling directly self.getoption():

          if not self.get_option("all_logs"):
              self.add_copy_spec([
                  "/var/log/ubuntu-advantage.log",
                  "/var/log/ubuntu-advantage.log.1",
                  "/var/log/ubuntu-advantage.log.2*",
              ])
          else:
              self.add_copy_spec("/var/log/ubuntu-advantage.log*")
    
  • I can see that lots of commands captured in this plugin are being captured already via ceph_mon, ceph_mgr, etc. Is there an scenario where microceph plugin will run but not all other ceph related plugins?

@nkshirsagar
Copy link
Contributor Author

nkshirsagar commented Jun 28, 2023

  • Please fix the flake8 style warnings and error as per the Flake8 test.

Thanks Jose! Will do.. This is a draft PR and it needs more work, I will mark it ready for review once it's completed.
The reason I put it out as a draft is to discuss with the canonical folks about it and (for eg, ) whether microceph would need split just like the ceph plugins that are split into mon, OSD etc.
I'm trying to keep just one microceph plugin instead of several split ones.

  • Regarding 'all_logs' var: I think you need to define what's all logs, and use the variable to select the actual logs you'll need for this specific plugin. See places like salt.py or ubuntu.py for examples. In ubuntu.py you can see how you can actually omit defining the var by calling directly self.getoption():
          if not self.get_option("all_logs"):
              self.add_copy_spec([
                  "/var/log/ubuntu-advantage.log",
                  "/var/log/ubuntu-advantage.log.1",
                  "/var/log/ubuntu-advantage.log.2*",
              ])
          else:
              self.add_copy_spec("/var/log/ubuntu-advantage.log*")
    

Yes I'll use this appropriately, am still figuring out what to collect without the -all-logs.

  • I can see that lots of commands captured in this plugin are being captured already via ceph_mon, ceph_mgr, etc. Is there an scenario where microceph plugin will run but not all other ceph related plugins?

iiuc, the usual ceph plugins won't be triggered in a microceph environment. Microceph is ceph running in a snap.

Copy link
Member

@TurboTurtle TurboTurtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With regards to a new plugin for microceph or not due to the overlap with existing ceph plugins, would it not be possible (or even preferrable) to instead update those existing plugins to enable when the microceph snap is installed?

@nkshirsagar
Copy link
Contributor Author

nkshirsagar commented Jun 30, 2023

I was of the opinion its better to have a separate plugin for microceph, and avoid changing the stable ceph plugin code to incorporate microceph in those same (split) plugins.

But on the flip side, we'd have to maintain microceph and patch it anytime something changes in the ceph plugin, and also the more I think about it, the split seems unavoidable, otherwise we'd end up duplicating the info in the sos when someone runs sos on the microceph mon node, and then the osd node.

Also upon further reflection, its better patching the ceph plugins to incorporate microceph too, so we would not have to then additionally patch sosreport analysis tools (hotsos, xsos, etc) for microceph information.

So if its allright having the microceph stuff in the usual ceph folders, like sos_commands/ceph_common , sos_commands/ceph_osd , sos_commands/ceph_mon etc, then I'll modify the PR to make the split, and revert to patching the ceph plugins.

@pponnuvel
Copy link
Contributor

pponnuvel commented Jun 30, 2023

I was of the opinion its better to have a separate plugin for microceph, and avoid changing the stable ceph plugin code to incorporate microceph in those same (split) plugins.

But on the flip side, we'd have to maintain microceph and patch it anytime something changes in the ceph plugin, and also the more I think about it, the split seems unavoidable, otherwise we'd end up duplicating the info in the sos when someone runs sos on the microceph mon node, and then the osd node.

Also upon further reflection, its better patching the ceph plugins to incorporate microceph too, so we would not have to then additionally patch sosreport analysis tools (hotsos, xsos, etc) for microceph information.

So if its allright having the microceph stuff in the usual ceph folders, like sos_commands/ceph_common , sos_commands/ceph_osd , sos_commands/ceph_mon etc, then I'll modify the PR to make the split, and revert to patching the ceph plugins.

I can see arguments for both. But I am slightly more inclined to incorporating microceph into the existing ones as the majority of cmds that microceph currently has (or would have in the future) will always be a subset of the existing ones.
Location of files (files, config, etc) are different in microceph but this isn't difficult to absorb.

One thing I'd add is we probably want to keep the microceph commands' outputs in a separate directory.

For example, consider a physical machine running a ceph-{mon, mgr, osd} of a cluster also running a different microceph deployed Ceph cluster. So we wouldn't want to put those under ceph_{mon, mgr, osd} directories. So maybe a microceph directory under sos_commands or inside ceph_{mon, mgr, osd} can be an option.

@nkshirsagar
Copy link
Contributor Author

I was of the opinion its better to have a separate plugin for microceph, and avoid changing the stable ceph plugin code to incorporate microceph in those same (split) plugins.
But on the flip side, we'd have to maintain microceph and patch it anytime something changes in the ceph plugin, and also the more I think about it, the split seems unavoidable, otherwise we'd end up duplicating the info in the sos when someone runs sos on the microceph mon node, and then the osd node.
Also upon further reflection, its better patching the ceph plugins to incorporate microceph too, so we would not have to then additionally patch sosreport analysis tools (hotsos, xsos, etc) for microceph information.
So if its allright having the microceph stuff in the usual ceph folders, like sos_commands/ceph_common , sos_commands/ceph_osd , sos_commands/ceph_mon etc, then I'll modify the PR to make the split, and revert to patching the ceph plugins.

I can see arguments for both. But I am slightly more inclined to incorporating microceph into the existing ones as the majority of cmds that microceph currently has (or would have in the future) will always be a subset of the existing ones. Location of files (files, config, etc) are different in microceph but this isn't difficult to absorb.

One thing I'd add is we probably want to keep the microceph commands' outputs in a separate directory.

For example, consider a physical machine running a ceph-{mon, mgr, osd} of a cluster also running a different microceph deployed Ceph cluster. So we wouldn't want to put those under ceph_{mon, mgr, osd} directories. So maybe a microceph directory under sos_commands or inside ceph_{mon, mgr, osd} can be an option.

So one of the reasons I didn't want to incorporate microceph into the existing ceph plugins is we would need to trigger 2 plugins from one file. I'm also not sure of how to create the sos_commands/microceph folder to dump all its files in, instead of the default of sos_commands/plugin_name, which would end up dumping microceph files and outputs in sos_commands/ceph_* .. I suppose there's some postprocessing I could do perhaps but I need to investigate further..

Since microceph would also run possibly its mon/osd/mgr/rgw on different nodes, I suppose the split into microceph_mon , microceph_osd, etc is necessary and cannot be avoided.

Assuming we're adding microceph collections in the ceph plugins, we'd need to take into consideration when the ceph_* plugin has been triggered due to ceph, or due to microceph, or both, because as Pon pointed out, microceph install can also exist additionally on a regular ceph node.

So would that basically be an if condition (if the regular ceph path exists, for eg, vs the microceph path) separating the two file and command collections in the same plugin?

I see the lxd plugin determining if a snap is installed, could I use something like that for determining microceph snap being installed?

        lxd_pkg = self.policy.package_manager.pkg_by_name('lxd')
        if lxd_pkg and lxd_pkg['pkg_manager'] == 'snap':
            self.add_cmd_output("lxd.buginfo", pred=lxd_pred)

            self.add_copy_spec([
                '/var/snap/lxd/common/config',
                '/var/snap/lxd/common/global-conf',
                '/var/snap/lxd/common/lxc/local.conf',
                '/var/snap/lxd/common/lxd/logs/*/*.conf',
            ])

            if not self.get_option("all_logs"):
                self.add_copy_spec([
                    '/var/snap/lxd/common/lxd/logs/*.log',
                    '/var/snap/lxd/common/lxd/logs/*/*.log',
                ])
            else:
                self.add_copy_spec([
                    '/var/snap/lxd/common/lxd/logs/**',
                ])
        else:
            self.add_copy_spec([
                "/etc/default/lxd-bridge",
                "/var/log/lxd/*"
            ])

@TurboTurtle
Copy link
Member

If microceph commands are going to be exclusively (or almost exclusively) a subset of existing ceph commands, then I very strongly suggest that the microceph collections be added into the existing plugins. If we add a separate microceph_* plugin for each ceph component, we'll have a much larger maintenance overhead on our hands than just keeping them in the same plugin and accounting for the different deployment options.

@nkshirsagar
Copy link
Contributor Author

nkshirsagar commented Jul 9, 2023

Some testing done for microceph,

root@demonax:/home/ubuntu/nikhil/sos# bin/sos report -o ceph_mon

sosreport (version 4.5.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   ceph_mon        [Running: ceph_mon]                                      

  Finished running plugins                                                               
Creating compressed archive...


cd /tmp
Your sosreport has been generated and saved in:
	/tmp/sosreport-demonax-2023-07-09-kcuscsp.tar.xz

 Size	36.77MiB
 Owner	root
 sha256	f2b83d0e4c750279f02f83823cb351e8fff95340f0fb4c025fa26c9a51232b0c

Please send this file to your support representative.

root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# 
root@demonax:/home/ubuntu/nikhil/sos# cd /tmp
root@demonax:/tmp# tar -xf /tmp/sosreport-demonax-2023-07-09-kcuscsp.tar.xz
cd root@demonax:/tmp# /tmp/sosreport-demonax-2023-07-09-kcuscsp
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# ls
dev  sos_commands  sos_logs  sos_reports  var  version.txt
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cat sos_logs/
sos.log  ui.log   
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cat sos_logs/
sos.log  ui.log   
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cat sos_logs/^C
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cd sos_commands/ceph_mon/
ceph_config-key_dump               ceph_df_detail                     ceph_mgr_dump                      ceph_osd_crush_dump                ceph_osd_numa-status               ceph_report
ceph_config_dump                   ceph_features                      ceph_mgr_metadata                  ceph_osd_crush_show-tunables       ceph_osd_perf                      ceph_status
ceph_config_generate-minimal-conf  ceph_fs_dump                       ceph_mgr_module_ls                 ceph_osd_crush_tree_--show-shadow  ceph_osd_pool_autoscale-status     ceph_time-sync-status
ceph_config_log                    ceph_fs_ls                         ceph_mgr_services                  ceph_osd_df                        ceph_osd_pool_ls_detail            ceph_versions
ceph_crash_ls                      ceph_insights                      ceph_mgr_versions                  ceph_osd_df_tree                   ceph_osd_stat                      json_output/
ceph_crash_stat                    ceph_log_last_10000_debug_audit    ceph_mon_dump                      ceph_osd_dump                      ceph_pg_dump                       
ceph_device_ls                     ceph_log_last_10000_debug_cluster  ceph_mon_stat                      ceph_osd_erasure-code-profile_ls   ceph_pg_stat                       
ceph_df                            ceph_mds_stat                      ceph_osd_blocked-by                ceph_osd_metadata                  ceph_quorum_status                 
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cd sos_commands/ceph_mon/
ceph_config-key_dump               ceph_df_detail                     ceph_mgr_dump                      ceph_osd_crush_dump                ceph_osd_numa-status               ceph_report
ceph_config_dump                   ceph_features                      ceph_mgr_metadata                  ceph_osd_crush_show-tunables       ceph_osd_perf                      ceph_status
ceph_config_generate-minimal-conf  ceph_fs_dump                       ceph_mgr_module_ls                 ceph_osd_crush_tree_--show-shadow  ceph_osd_pool_autoscale-status     ceph_time-sync-status
ceph_config_log                    ceph_fs_ls                         ceph_mgr_services                  ceph_osd_df                        ceph_osd_pool_ls_detail            ceph_versions
ceph_crash_ls                      ceph_insights                      ceph_mgr_versions                  ceph_osd_df_tree                   ceph_osd_stat                      json_output/
ceph_crash_stat                    ceph_log_last_10000_debug_audit    ceph_mon_dump                      ceph_osd_dump                      ceph_pg_dump                       
ceph_device_ls                     ceph_log_last_10000_debug_cluster  ceph_mon_stat                      ceph_osd_erasure-code-profile_ls   ceph_pg_stat                       
ceph_df                            ceph_mds_stat                      ceph_osd_blocked-by                ceph_osd_metadata                  ceph_quorum_status                 
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp# cd sos_commands/ceph_mon/
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon# ls
ceph_config-key_dump               ceph_df_detail                     ceph_mgr_dump        ceph_osd_crush_dump                ceph_osd_numa-status            ceph_report
ceph_config_dump                   ceph_features                      ceph_mgr_metadata    ceph_osd_crush_show-tunables       ceph_osd_perf                   ceph_status
ceph_config_generate-minimal-conf  ceph_fs_dump                       ceph_mgr_module_ls   ceph_osd_crush_tree_--show-shadow  ceph_osd_pool_autoscale-status  ceph_time-sync-status
ceph_config_log                    ceph_fs_ls                         ceph_mgr_services    ceph_osd_df                        ceph_osd_pool_ls_detail         ceph_versions
ceph_crash_ls                      ceph_insights                      ceph_mgr_versions    ceph_osd_df_tree                   ceph_osd_stat                   json_output
ceph_crash_stat                    ceph_log_last_10000_debug_audit    ceph_mon_dump        ceph_osd_dump                      ceph_pg_dump
ceph_device_ls                     ceph_log_last_10000_debug_cluster  ceph_mon_stat        ceph_osd_erasure-code-profile_ls   ceph_pg_stat
ceph_df                            ceph_mds_stat                      ceph_osd_blocked-by  ceph_osd_metadata                  ceph_quorum_status
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon# ls -lrth
total 4.3M
-rw-r--r-- 1 root root    0 Jul  9 08:16 ceph_crash_ls
-rw-r--r-- 1 root root  37K Jul  9 08:16 ceph_report
-rw-r--r-- 1 root root  126 Jul  9 08:16 ceph_mon_stat
-rw-r--r-- 1 root root  989 Jul  9 08:16 ceph_quorum_status
-rw-r--r-- 1 root root  567 Jul  9 08:16 ceph_versions
-rw-r--r-- 1 root root  716 Jul  9 08:16 ceph_features
-rw-r--r-- 1 root root  133 Jul  9 08:16 ceph_insights
-rw-r--r-- 1 root root   19 Jul  9 08:16 ceph_crash_stat
-rw-r--r-- 1 root root  276 Jul  9 08:16 ceph_config_dump
-rw-r--r-- 1 root root  323 Jul  9 08:16 ceph_config_log
-rw-r--r-- 1 root root  175 Jul  9 08:16 ceph_config_generate-minimal-conf
-rw-r--r-- 1 root root  796 Jul  9 08:16 ceph_config-key_dump
-rw-r--r-- 1 root root 6.5K Jul  9 08:16 ceph_osd_metadata
-rw-r--r-- 1 root root    8 Jul  9 08:16 ceph_osd_erasure-code-profile_ls
-rw-r--r-- 1 root root 3.5K Jul  9 08:16 ceph_osd_crush_dump
-rw-r--r-- 1 root root  606 Jul  9 08:16 ceph_osd_crush_show-tunables
-rw-r--r-- 1 root root  228 Jul  9 08:16 ceph_osd_crush_tree_--show-shadow
-rw-r--r-- 1 root root 155K Jul  9 08:16 ceph_mgr_dump
-rw-r--r-- 1 root root  743 Jul  9 08:16 ceph_mgr_metadata
-rw-r--r-- 1 root root  986 Jul  9 08:16 ceph_mgr_module_ls
-rw-r--r-- 1 root root    3 Jul  9 08:16 ceph_mgr_services
-rw-r--r-- 1 root root   92 Jul  9 08:16 ceph_mgr_versions
-rw-r--r-- 1 root root 1.7M Jul  9 08:16 ceph_log_last_10000_debug_cluster
-rw-r--r-- 1 root root 2.3M Jul  9 08:16 ceph_log_last_10000_debug_audit
-rw-r--r-- 1 root root  269 Jul  9 08:16 ceph_mon_dump
-rw-r--r-- 1 root root  374 Jul  9 08:16 ceph_status
-rw-r--r-- 1 root root  370 Jul  9 08:16 ceph_device_ls
-rw-r--r-- 1 root root  258 Jul  9 08:16 ceph_df
-rw-r--r-- 1 root root  446 Jul  9 08:16 ceph_df_detail
-rw-r--r-- 1 root root   23 Jul  9 08:16 ceph_fs_ls
-rw-r--r-- 1 root root  545 Jul  9 08:16 ceph_fs_dump
-rw-r--r-- 1 root root 1.8K Jul  9 08:16 ceph_pg_dump
-rw-r--r-- 1 root root   73 Jul  9 08:16 ceph_pg_stat
-rw-r--r-- 1 root root  105 Jul  9 08:16 ceph_time-sync-status
-rw-r--r-- 1 root root   54 Jul  9 08:16 ceph_osd_stat
-rw-r--r-- 1 root root  902 Jul  9 08:16 ceph_osd_df_tree
-rw-r--r-- 1 root root 1.3K Jul  9 08:16 ceph_osd_dump
-rw-r--r-- 1 root root  559 Jul  9 08:16 ceph_osd_df
-rw-r--r-- 1 root root  172 Jul  9 08:16 ceph_osd_perf
-rw-r--r-- 1 root root   17 Jul  9 08:16 ceph_osd_blocked-by
-rw-r--r-- 1 root root  205 Jul  9 08:16 ceph_osd_pool_ls_detail
-rw-r--r-- 1 root root  262 Jul  9 08:16 ceph_osd_pool_autoscale-status
-rw-r--r-- 1 root root   14 Jul  9 08:16 ceph_mds_stat
-rw-r--r-- 1 root root  188 Jul  9 08:16 ceph_osd_numa-status
drwx------ 2 root root 4.0K Jul  9 08:17 json_output
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon# cat ceph_osd_df
ID  CLASS  WEIGHT   REWEIGHT  SIZE     RAW USE  DATA     OMAP  META     AVAIL    %USE  VAR   PGS  STATUS
 0         3.63869   1.00000  3.6 TiB   77 MiB  1.4 MiB   0 B   75 MiB  3.6 TiB  0.00  1.00    1      up
 1         3.63869   1.00000  3.6 TiB   77 MiB  1.4 MiB   0 B   75 MiB  3.6 TiB  0.00  1.00    1      up
 2         3.63869   1.00000  3.6 TiB   77 MiB  1.4 MiB   0 B   75 MiB  3.6 TiB  0.00  1.00    1      up
                       TOTAL   11 TiB  232 MiB  4.2 MiB   0 B  226 MiB   11 TiB  0.00                   
MIN/MAX VAR: 1.00/1.00  STDDEV: 0
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon# cd json_output/
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon/json_output# ls
ceph_device_ls_--format_json-pretty      ceph_mds_stat_--format_json-pretty        ceph_osd_numa-status_--format_json-pretty            ceph_pg_dump_--format_json-pretty
ceph_df_--format_json-pretty             ceph_mon_dump_--format_json-pretty        ceph_osd_perf_--format_json-pretty                   ceph_pg_stat_--format_json-pretty
ceph_df_detail_--format_json-pretty      ceph_osd_blocked-by_--format_json-pretty  ceph_osd_pool_autoscale-status_--format_json-pretty  ceph_status_--format_json-pretty
ceph_fs_dump_--format_json-pretty        ceph_osd_df_--format_json-pretty          ceph_osd_pool_ls_detail_--format_json-pretty         ceph_tell_mon.demonax_mon_status
ceph_fs_ls_--format_json-pretty          ceph_osd_df_tree_--format_json-pretty     ceph_osd_stat_--format_json-pretty                   ceph_time-sync-status_--format_json-pretty
ceph_health_detail_--format_json-pretty  ceph_osd_dump_--format_json-pretty        ceph_osd_tree_--format_json-pretty
root@demonax:/tmp/sosreport-demonax-2023-07-09-kcuscsp/sos_commands/ceph_mon/json_output# ls -lrths
total 132K
4.0K -rw-r--r-- 1 root root   66 Jul  9 08:16 ceph_health_detail_--format_json-pretty
4.0K -rw-r--r-- 1 root root 1.5K Jul  9 08:16 ceph_osd_tree_--format_json-pretty
4.0K -rw-r--r-- 1 root root 3.3K Jul  9 08:16 ceph_tell_mon.demonax_mon_status
4.0K -rw-r--r-- 1 root root 1.4K Jul  9 08:16 ceph_mon_dump_--format_json-pretty
4.0K -rw-r--r-- 1 root root 1.4K Jul  9 08:16 ceph_status_--format_json-pretty
4.0K -rw-r--r-- 1 root root 1.1K Jul  9 08:17 ceph_device_ls_--format_json-pretty
4.0K -rw-r--r-- 1 root root  728 Jul  9 08:17 ceph_df_--format_json-pretty
4.0K -rw-r--r-- 1 root root 1.3K Jul  9 08:17 ceph_df_detail_--format_json-pretty
4.0K -rw-r--r-- 1 root root    4 Jul  9 08:17 ceph_fs_ls_--format_json-pretty
4.0K -rw-r--r-- 1 root root 2.3K Jul  9 08:17 ceph_fs_dump_--format_json-pretty
 32K -rw-r--r-- 1 root root  32K Jul  9 08:17 ceph_pg_dump_--format_json-pretty
4.0K -rw-r--r-- 1 root root  403 Jul  9 08:17 ceph_pg_stat_--format_json-pretty
4.0K -rw-r--r-- 1 root root  106 Jul  9 08:17 ceph_time-sync-status_--format_json-pretty
4.0K -rw-r--r-- 1 root root  176 Jul  9 08:17 ceph_osd_stat_--format_json-pretty
4.0K -rw-r--r-- 1 root root 3.3K Jul  9 08:17 ceph_osd_df_tree_--format_json-pretty
 16K -rw-r--r-- 1 root root  13K Jul  9 08:17 ceph_osd_dump_--format_json-pretty
4.0K -rw-r--r-- 1 root root 2.2K Jul  9 08:17 ceph_osd_df_--format_json-pretty
4.0K -rw-r--r-- 1 root root  920 Jul  9 08:17 ceph_osd_perf_--format_json-pretty
4.0K -rw-r--r-- 1 root root   93 Jul  9 08:17 ceph_osd_blocked-by_--format_json-pretty
4.0K -rw-r--r-- 1 root root 2.3K Jul  9 08:17 ceph_osd_pool_ls_detail_--format_json-pretty
4.0K -rw-r--r-- 1 root root  665 Jul  9 08:17 ceph_osd_pool_autoscale-status_--format_json-pretty
4.0K -rw-r--r-- 1 root root 2.7K Jul  9 08:17 ceph_mds_stat_--format_json-pretty
4.0K -rw-r--r-- 1 root root  175 Jul  9 08:17 ceph_osd_numa-status_--format_json-pretty


root@demonax:/home/ubuntu/nikhil/sos# bin/sos report -o ceph_common

sosreport (version 4.5.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   ceph_common     [Running: ceph_common]                                   
  Finished running plugins                                                               
Creating compressed archive...

Your sosreport has been generated and saved in:
	/tmp/sosreport-demonax-2023-07-09-gynlqum.tar.xz

 Size	1.64MiB
 Owner	root
 sha256	a8b0b4940bd5b0bec7a6e2dfcefd03f0125bb486f895fbd62a3c66802a22ec19

Please send this file to your support representative.

root@demonax:/home/ubuntu/nikhil/sos# cd /tmp
root@demonax:/tmp# tar -xf /tmp/sosreport-demonax-2023-07-09-gynlqum.tar.xz
root@demonax:/tmp# cd /tmp/sosreport-demonax-2023-07-09-gynlqum
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum# ls
sos_commands  sos_logs  sos_reports  sos_strings  var  version.txt
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum# cd sos_commands/
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/sos_commands# ls
ceph_common
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/sos_commands# cat ceph_common/ceph_-v
ceph version 17.2.5 (98318ae89f1a893a6ded3a640405cdbb33e08757) quincy (stable)
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/sos_commands# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum# ls
sos_commands  sos_logs  sos_reports  sos_strings  var  version.txt
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum# cd var/snap/microceph/common/
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/var/snap/microceph/common# ls
logs
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/var/snap/microceph/common# cd logs/
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/var/snap/microceph/common/logs# ls
ceph.audit.log  ceph.log
root@demonax:/tmp/sosreport-demonax-2023-07-09-gynlqum/var/snap/microceph/common/logs# 


root@demonax:/home/ubuntu/nikhil/sos# bin/sos report -o ceph_osd

sosreport (version 4.5.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   ceph_osd        [Running: ceph_osd]                                      
  Finished running plugins                                                               
Creating compressed archive...

Your sosreport has been generated and saved in:
	/tmp/sosreport-demonax-2023-07-09-fygfbzj.tar.xz

 Size	45.07KiB
 Owner	root
 sha256	b6b81b135981e685f4ee676359fdf0019c6ae210046b7e10747184e62f41d3fc

Please send this file to your support representative.

root@demonax:/home/ubuntu/nikhil/sos# cd /tmp
root@demonax:/tmp# tar -xf /tmp/sosreport-demonax-2023-07-09-fygfbzj.tar.xz
root@demonax:/tmp# cd /tmp/sosreport-demonax-2023-07-09-fygfbzj
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj# ls
dev  sos_commands  sos_logs  sos_reports  sos_strings  var  version.txt
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj# cd sos_commands/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/sos_commands# ls
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/sos_commands# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj# cd var/snap/microceph/common/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common# ls
data  logs
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common# cd data/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data# ls
osd
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data# cd osd/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data/osd# ls
ceph-0  ceph-1  ceph-2
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data/osd# cd ceph-0
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data/osd/ceph-0# ls
bfm_blocks  bfm_blocks_per_key  bfm_bytes_per_block  bfm_size  block  bluefs  ceph_fsid  fsid  kv_backend  magic  mkfs_done  ready  require_osd_release  type  whoami
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data/osd/ceph-0# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data/osd# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data# d ..
d: command not found
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/data# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common# ls
data  logs
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common# cd logs/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls
ceph-osd.2.log
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/
338/     common/  current/ 
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ceph
ceph-mds.demonax.log  ceph-mgr.demonax.log  ceph-mon.demonax.log  ceph-osd.0.log        ceph-osd.1.log        ceph-osd.2.log        ceph.audit.log        ceph.log              
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ceph
ceph-mds.demonax.log  ceph-mgr.demonax.log  ceph-mon.demonax.log  ceph-osd.0.log        ceph-osd.1.log        ceph-osd.2.log        ceph.audit.log        ceph.log              
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ceph -lrt
ls: cannot access '/var/snap/microceph/common/logs/ceph': No such file or directory
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ceph
ceph-mds.demonax.log  ceph-mgr.demonax.log  ceph-mon.demonax.log  ceph-osd.0.log        ceph-osd.1.log        ceph-osd.2.log        ceph.audit.log        ceph.log              
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ceph
ceph-mds.demonax.log  ceph-mgr.demonax.log  ceph-mon.demonax.log  ceph-osd.0.log        ceph-osd.1.log        ceph-osd.2.log        ceph.audit.log        ceph.log              
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# ls /var/snap/microceph/common/logs/ -lrth
total 1.7G
-rw-r--r-- 1 root root  613 Jun  2 09:48 ceph-mds.demonax.log
-rw-r--r-- 1 root root 244M Jul  9 10:15 ceph-osd.0.log
-rw-r--r-- 1 root root 244M Jul  9 10:15 ceph-osd.1.log
-rw-r--r-- 1 root root 244M Jul  9 10:15 ceph-osd.2.log
-rw-r--r-- 1 root root 334M Jul  9 10:19 ceph-mon.demonax.log
-rw------- 1 root root  25M Jul  9 10:19 ceph.audit.log
-rw-r--r-- 1 root root 370M Jul  9 10:19 ceph-mgr.demonax.log
-rw------- 1 root root 254M Jul  9 10:19 ceph.log
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common/logs# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph/common# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap/microceph# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var/snap# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/var# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj# ls
dev  sos_commands  sos_logs  sos_reports  sos_strings  var  version.txt
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj# cd sos_logs/
root@demonax:/tmp/sosreport-demonax-2023-07-09-fygfbzj/sos_logs# ls
sos.log  ui.log

2023-07-09 10:17:00,618 INFO: [plugin:ceph_osd] File '/var/snap/microceph/common/logs/ceph-osd.2.log' is over size limit, will instead tail the file during collection phase.
2023-07-09 10:17:00,619 INFO: [plugin:ceph_osd] skipping '/var/snap/microceph/common/logs/ceph-osd.1.log' over size limit
2023-07-09 10:17:00,619 INFO: [plugin:ceph_osd] skipping '/var/snap/microceph/common/logs/ceph-osd.0.log' over size limit

--all-logs should be able to handle these.

root@demonax:/home/ubuntu/nikhil/sos# bin/sos report -o ceph_osd --all-logs

sosreport (version 4.5.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   ceph_osd        [Running: ceph_osd]                                      
  Finished running plugins                                                               
Creating compressed archive...
cd /tmp
tar -xf 
Your sosreport has been generated and saved in:
	/tmp/sosreport-demonax-2023-07-09-qegrfpu.tar.xz

 Size	1.13MiB
 Owner	root
 sha256	ae8f738e533688a291c055c25e39b0b7ac1a78f15ee7df2a34235128b9fc81db

Please send this file to your support representative.

root@demonax:/home/ubuntu/nikhil/sos# cd /tmp
root@demonax:/tmp# tar -xf /tmp/sosreport-demonax-2023-07-09-qegrfpu.tar.xz
cd /tmp/sosreport-demonax-2023-07-09-qegrfpu.tar.xzroot@demonax:/tmp# cd /tmp/sosreport-demonax-2023-07-09-qegrfpu
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# vi sos_logs/
sos.log  ui.log   
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# vi sos_logs/
sos.log  ui.log   
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# vi sos_logs/sos.log 
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# cd v
var/         version.txt  
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# cd v
var/         version.txt  
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# cd v
var/         version.txt  
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu# cd var/snap/microceph/common/
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common# ls
data  logs
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common# cd data/
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data# ls
osd
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data# cd osd/
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd# ls
ceph-0  ceph-1  ceph-2
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd# cd ceph-0/
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd/ceph-0# ls
bfm_blocks  bfm_blocks_per_key  bfm_bytes_per_block  bfm_size  block  bluefs  ceph_fsid  fsid  kv_backend  magic  mkfs_done  ready  require_osd_release  type  whoami
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd/ceph-0# ls -lrth
total 52K
-rw------- 1 root root 36 Jun  2 10:04 fsid
-rw------- 1 root root 10 Jun  2 10:04 type
-rw------- 1 root root 10 Jun  2 10:04 bfm_blocks
-rw------- 1 root root 14 Jun  2 10:04 bfm_size
-rw------- 1 root root  5 Jun  2 10:04 bfm_bytes_per_block
-rw------- 1 root root  4 Jun  2 10:04 bfm_blocks_per_key
-rw------- 1 root root  8 Jun  2 10:04 kv_backend
-rw------- 1 root root  2 Jun  2 10:04 bluefs
-rw------- 1 root root  4 Jun  2 10:04 mkfs_done
-rw------- 1 root root 21 Jun  2 10:04 magic
-rw------- 1 root root  2 Jun  2 10:04 whoami
-rw------- 1 root root 37 Jun  2 10:04 ceph_fsid
-rw------- 1 root root  0 Jun  2 10:04 ready
-rw------- 1 root root  3 Jun  2 10:05 require_osd_release
lrwxrwxrwx 1 root root 58 Jul  9 00:07 block -> ../../../../../../../dev/disk/by-id/wwn-0x3001438040152301
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd/ceph-0# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data/osd# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/data# cd ..
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common# cd logs
root@demonax:/tmp/sosreport-demonax-2023-07-09-qegrfpu/var/snap/microceph/common/logs# ls
ceph-osd.0.log  ceph-osd.1.log  ceph-osd.2.log

@nkshirsagar
Copy link
Contributor Author

I am not sure whether we need to collect rgw/mds logs for microceph. The only thing the microceph plugin would collect are the concerned log files (no daemon commands would run in microceph env), which can be asked for individually instead of having them run a sosreport. So for now I am marking this PR ready for review for the microceph changes for mon,mgr and osd. I am sure as microceph evolves, there will be additional changes required, and we can handle the mds/rgw bits at that time. Please let me know what you think @pponnuvel

@nkshirsagar nkshirsagar marked this pull request as ready for review July 10, 2023 03:46
Copy link
Member

@TurboTurtle TurboTurtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good, just a note about path checks. We can use Plugin.path_exists() here to account for non-/ sysroots, such as when sos is run in a container.

sos/report/plugins/ceph_common.py Outdated Show resolved Hide resolved
sos/report/plugins/ceph_mon.py Outdated Show resolved Hide resolved
sos/report/plugins/ceph_osd.py Outdated Show resolved Hide resolved

if not all_logs:
self.add_copy_spec("/var/log/calamari/*.log",)
if not self.path_exists('/var/snap/microceph/common'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the existance of files (e.g. /var/snap/microceph/common) to influence the plugin behaviour, can we use the new snap package manager support from #3226 instead?

See for example #3257

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack this can be done and in fact was thinking about this approach in the last part of #3291 (comment) , I will change it to this approach

)

else:
# Only collect microceph files, don't run any commands
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we want to run any commands? I would expect to still want all the OSD commands regardless of whether we are using microceph or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in microceph, I can run the ceph commands (on the mon nodes) but not the ceph daemon commands on the OSD nodes that the OSD nodes run for ceph_osd collections.

ubuntu@demonax:~$ sudo -s
root@demonax:/home/ubuntu# ceph -s
  cluster:
    id:     fea9b2ee-20f0-45c1-838e-03bc1d6667bf
    health: HEALTH_OK
 
  services:
    mon: 1 daemons, quorum demonax (age 5w)
    mgr: demonax(active, since 5w)
    osd: 3 osds: 3 up (since 5w), 3 in (since 5w)
 
  data:
    pools:   1 pools, 1 pgs
    objects: 2 objects, 577 KiB
    usage:   240 MiB used, 11 TiB / 11 TiB avail
    pgs:     1 active+clean
 
root@demonax:/home/ubuntu# ps -efa | grep osd
root       34627       1  0 Jun02 ?        00:00:00 /bin/sh /snap/microceph/338/commands/osd.start
root       36645       1  0 Jun02 ?        02:15:10 ceph-osd --cluster ceph --id 0
root       38275       1  0 Jun02 ?        02:17:26 ceph-osd --cluster ceph --id 1
root       39929       1  0 Jun02 ?        02:16:48 ceph-osd --cluster ceph --id 2
root      195108  195052  0 09:23 pts/1    00:00:00 grep --color=auto osd
root@demonax:/home/ubuntu# ceph daemon osd.0 help
Can't get admin socket path: "ceph-conf" not found

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we want to run any commands? I would expect to still want all the OSD commands regardless of whether we are using microceph or not.

actually I think this might be a bug in microceph so I've raised canonical/microceph#160 , if its supposed to work then I'll change the code in ceph_osd to also run the ceph daemon commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll submit a new PR later to add the ceph daemon command collections once canonical/microceph#160 gets resolved.

"/var/lib/ceph/**/kv_backend",
"/var/log/ceph/**/*ceph-mon*.log"
])
else:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating all of the copy specs, could we calculate a path prefix instead?

e.g.

if microceph:
    data_dir = '/var/snap/microceph/common/data'
else:
    data_dir = '/var/lib/ceph'
  
self.add_copy_spec([
    os.path.join(data_dir, 'mon/*/store.db')
])

something like this used to be done for containers although I think it was since mostly replaced with the logic for looking for paths inside containers instead. so most of the code that did similar seems gone now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was avoiding touching any of the existing ceph code, so apart from an else i tried to not change it. I can do it this way, sure..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The files we collect aren't the same, for eg the calamari ones are not present in the microceph env, so for eg, in the ceph_common now, (am using the snap detection method here)

        microceph_pkg = self.policy.package_manager.pkg_by_name('microceph')
        if not microceph_pkg:
<snip>

            if not all_logs:
                self.add_copy_spec("/var/log/calamari/*.log",)
            else:
                self.add_copy_spec("/var/log/calamari",)

            self.add_copy_spec([
                "/var/log/ceph/**/ceph.log",
                "/var/log/ceph/**/ceph.audit.log*",
                "/var/log/calamari/*.log",
                "/etc/ceph/",
                "/etc/calamari/",
                "/var/lib/ceph/tmp/",
            ])

            self.add_forbidden_path([
                "/etc/ceph/*keyring*",
                "/var/lib/ceph/*keyring*",
                "/var/lib/ceph/*/*keyring*",
                "/var/lib/ceph/*/*/*keyring*",
                "/var/lib/ceph/osd",
                "/var/lib/ceph/mon",
                # Excludes temporary ceph-osd mount location like
                # /var/lib/ceph/tmp/mnt.XXXX from sos collection.
                "/var/lib/ceph/tmp/*mnt*",
                "/etc/ceph/*bindpass*"
            ])
        else:
            self.add_copy_spec([
                "/var/snap/microceph/common/logs/ceph.log",
                "/var/snap/microceph/common/logs/ceph.audit.log",
            ])

The forbidden paths are also unnecessary for microceph since we don't collect anything but those two logs. So since the microceph log collections are smaller than ceph, and that holds true for the other ceph plugins too, I've separated them out, hence the duplicate add_copy_spec() calls.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @lathiat, if we have common file paths, then it would be easier to change one line, rather than 2 lines foe anything we are collecting. It just means less error-prone and less items to change if there are nay changes required in the future.

imo, if a file doesn't exist, then there isn't a real problem, it will be skipped by sos anyway. So, having a common set should reduce the amount of items we add

Copy link
Contributor Author

@nkshirsagar nkshirsagar Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at ceph_common as an example, I've tried making the change recommended in the review to have a common PATH variable and use only one code path for the file collections, but I still feel the code is eventually cleaner and easier to follow with the separation between the two plugins with one big "if".

The microceph stuff in ceph_common plugin as of now only collects two log files as opposed to several more in the ceph path,

            self.add_copy_spec([
                "/var/snap/microceph/common/logs/ceph.log",
                "/var/snap/microceph/common/logs/ceph.audit.log",
            ])

The ceph_common plugin as of now collects more stuff, so for eg consider, the only thing in common is marked in <==

        if not microceph_pkg:
            self.add_file_tags({
                '.*/ceph.conf': 'ceph_conf',
                '/var/log/ceph(.*)?/ceph.log.*': 'ceph_log',
            })

        if not all_logs:
                self.add_copy_spec("/var/log/calamari/*.log",)
            else:
                self.add_copy_spec("/var/log/calamari",)

            self.add_copy_spec([
                "/var/log/ceph/**/ceph.log", <==
                "/var/log/ceph/**/ceph.audit.log*", <==
                "/var/log/calamari/*.log",
                "/etc/ceph/",
                "/etc/calamari/",
                "/var/lib/ceph/tmp/",
            ])

            self.add_forbidden_path([
                "/etc/ceph/*keyring*",
                "/var/lib/ceph/*keyring*",
                "/var/lib/ceph/*/*keyring*",
                "/var/lib/ceph/*/*/*keyring*",
                "/var/lib/ceph/osd",
                "/var/lib/ceph/mon",
                # Excludes temporary ceph-osd mount location like
                # /var/lib/ceph/tmp/mnt.XXXX from sos collection.
                "/var/lib/ceph/tmp/*mnt*",

So I think it's still more reasonable to separate it out with a "if" instead of trying to have common code. It's also easier in the future to make changes to either plugin if there's a clean separation.

If I look at ceph_osd, as another eg,

            self.add_copy_spec([
                "/var/snap/microceph/common/data/osd/*",
                "/var/snap/microceph/common/logs/*ceph-osd*.log",
            ])

It's not necessary that microceph would collect a subset of the ceph plugin, the plugins may differ in the files they collect (and they do even now) because the /var/snap/microceph/common/data/osd/* folder in microceph would collect as of now all these files, (minus the keyring which is in the forbidden path)

root@demonax:/var/snap/microceph/common/data/osd/ceph-0# ls
bfm_blocks  bfm_blocks_per_key  bfm_bytes_per_block  bfm_size  block  bluefs  ceph_fsid  fsid  keyring  kv_backend  magic  mkfs_done  ready  require_osd_release  type  whoami
root@demonax:/var/snap/microceph/common/data/osd/ceph-0# 

I think if we have a common path, it would become more complex in the future maintaining this special situation we have, where we are triggering one of two plugins from the one plugin file. So I'd much rather have a clean separation instead of trying to run common code using path variables.

Please let me know whether this makes sense and if the separation is acceptable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack, makes sense to me

@nkshirsagar nkshirsagar changed the title [microceph][ubuntu] Add microceph plugin [microceph][ubuntu] Add changes for microceph collections Jul 12, 2023
Collect the microceph data in the ceph plugins.

Signed-off-by: Nikhil Kshirsagar <[email protected]>
Copy link
Member

@arif-ali arif-ali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, based on all the discussions

@TurboTurtle TurboTurtle merged commit 5bcdb79 into sosreport:main Jul 18, 2023
@nkshirsagar
Copy link
Contributor Author

mgr also needs additions for microceph, so I will add that in a separate PR later

@nkshirsagar
Copy link
Contributor Author

This work needs #3312 because without the wildcard support for paths in files, it will not trigger the microceph plugin. Initial testing was mistakenly done with -o passed to sos report, which resulted in the plugins triggering in spite of the fact that they should not trigger, due to the wildcard used in

    files = ('/var/lib/ceph/mon/', '/var/lib/ceph/*/mon*',
             '/var/snap/microceph/common/data/mon/*')

Tested to confirm on a microceph node that microceph data isnt collected in current sos main.

git root@demonax:/home/ubuntu/nikhil# git clone https://github.com/sosreport/sos/tree/main
Cloning into 'main'...
fatal: repository 'https://github.com/sosreport/sos/tree/main/' not found
root@demonax:/home/ubuntu/nikhil# git clone https://github.com/sosreport/sos/
Cloning into 'sos'...
remote: Enumerating objects: 33044, done.
remote: Counting objects: 100% (8221/8221), done.
remote: Compressing objects: 100% (3210/3210), done.
remote: Total 33044 (delta 5131), reused 5200 (delta 5005), pack-reused 24823
Receiving objects: 100% (33044/33044), 18.90 MiB | 2.46 MiB/s, done.
Resolving deltas: 100% (24350/24350), done.
root@demonax:/home/ubuntu/nikhil# ls
sos
root@demonax:/home/ubuntu/nikhil# cd sos/
root@demonax:/home/ubuntu/nikhil/sos# ls
AUTHORS  LICENSE  MANIFEST.in  README.md  bin  docs  man  plugins_overview.py  po  requirements.txt  setup.py  snap  sos  sos.conf  sos.spec  tests  tmpfiles
root@demonax:/home/ubuntu/nikhil/sos# bin/sos report

sosreport (version 4.5.5)

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.


Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
[plugin:networking] skipped command 'ip -s macsec show': required kmods missing: macsec.   Use '--allow-system-changes' to enable collection.
[plugin:networking] skipped command 'ss -peaonmi': required kmods missing: af_packet_diag, udp_diag, inet_diag, netlink_diag, xsk_diag, tcp_diag.   Use '--allow-system-changes' to enable collection.
 Running plugins. Please wait ...

  Finishing plugins              [Running: systemd]                                       
  Finished running plugins                                                               
Creating compressed archive...

Your sosreport has been generated and saved in:
	/tmp/sosreport-demonax-2023-07-19-evmobti.tar.xz

 Size	3.72MiB
 Owner	root
 sha256	de24b257fa6f4af85d9c50a509aa87bb49864777ccfff672623da61f89da6ae6

Please send this file to your support representative.

root@demonax:/home/ubuntu/nikhil/sos# tar -xf /tmp/sosreport-demonax-2023-07-19-evmobti.tar.xz
cd root@demonax:/home/ubuntu/nikhil/sos# cd sosreport-demonax-2023-07-19-evmobti/
boot/            dmidecode        free             installed-snaps  last             lsmod            mount            pstree           sos_commands/    sys/             usr/             vgdisplay
date             environment      hostname         ip_addr          lib/             lsof             proc/            root-symlinks    sos_logs/        uname            var/             
df               etc/             installed-debs   ip_route         lsb-release      lspci            ps               run/             sos_reports/     uptime           version.txt      
root@demonax:/home/ubuntu/nikhil/sos# cd sosreport-demonax-2023-07-19-evmobti/
boot/            dmidecode        free             installed-snaps  last             lsmod            mount            pstree           sos_commands/    sys/             usr/             vgdisplay
date             environment      hostname         ip_addr          lib/             lsof             proc/            root-symlinks    sos_logs/        uname            var/             
df               etc/             installed-debs   ip_route         lsb-release      lspci            ps               run/             sos_reports/     uptime           version.txt      
root@demonax:/home/ubuntu/nikhil/sos# cd sosreport-demonax-2023-07-19-evmobti/sos_commands/
root@demonax:/home/ubuntu/nikhil/sos/sosreport-demonax-2023-07-19-evmobti/sos_commands# ls
alternatives  apt    boot     cloud_init  date          devices  firewall_tables  host   kernel     login      lvm2  memory      pam   process    release   snap     sysvipc  usb
apparmor      ata    btrfs    console     dbus          dpkg     grub2            i18n   libraries  logrotate  lxd   multipath   pci   processor  scsi      ssh      ubuntu
apport        block  cgroups  cron        devicemapper  filesys  hardware         iscsi  libvirt    logs       md    networking  perl  python     services  systemd  ufw
root@demonax:/home/ubuntu/nikhil/sos/sosreport-demonax-2023-07-19-evmobti/sos_commands# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants