]> granicus.if.org Git - icinga2/blob - lib/cli/troubleshootcommand.hpp
add some object locking to the Dump method (which could theoreticylly suffer from...
[icinga2] / lib / cli / troubleshootcommand.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef TROUBLESHOOTCOMMAND_H
4 #define TROUBLESHOOTCOMMAND_H
5
6 #include "cli/clicommand.hpp"
7 #include "base/i2-base.hpp"
8 #include "base/dictionary.hpp"
9
10 namespace icinga
11 {
12
13 /**
14  * The "troubleshoot" command.
15  *
16  * @ingroup cli
17  */
18 class TroubleshootCommand final : public CLICommand
19 {
20 public:
21         DECLARE_PTR_TYPEDEFS(TroubleshootCommand);
22
23         String GetDescription() const override;
24         String GetShortDescription() const override;
25         int Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const override;
26         void InitParameters(boost::program_options::options_description& visibleDesc,
27                 boost::program_options::options_description& hiddenDesc) const override;
28
29 private:
30         class InfoLog;
31         class InfoLogLine;
32         static bool GeneralInfo(InfoLog& log, const boost::program_options::variables_map& vm);
33         static bool FeatureInfo(InfoLog& log, const boost::program_options::variables_map& vm);
34         static bool ObjectInfo(InfoLog& log, const boost::program_options::variables_map& vm,
35                 Dictionary::Ptr& logs, const String& path);
36         static bool ReportInfo(InfoLog& log, const boost::program_options::variables_map& vm,
37                 Dictionary::Ptr& logs);
38         static bool ConfigInfo(InfoLog& log, const boost::program_options::variables_map& vm);
39
40         static int Tail(const String& file, const int numLines, InfoLog& log);
41         static bool CheckFeatures(InfoLog& log);
42         static void GetLatestReport(const String& filename, time_t& bestTimestamp, String& bestFilename);
43         static bool PrintCrashReports(InfoLog& log);
44         static bool PrintFile(InfoLog& log, const String& path);
45         static bool CheckConfig();
46         static void CheckObjectFile(const String& objectfile, InfoLog& log, InfoLog *OFile, const bool objectConsole,
47                 Dictionary::Ptr& logs, std::set<String>& configs);
48         static bool PrintVarsFile(const String& path, const bool console);
49         static void PrintLoggers(InfoLog& log, Dictionary::Ptr& logs);
50         static void PrintObjectOrigin(InfoLog& log, const std::set<String>& configSet);
51 };
52
53 }
54 #endif /* TROUBLESHOOTCOMMAND_H */