Add statistics hisotry and service syslogs to the support
bundle
@@ -22,6 +22,7 @@ from fledge.services.core.connect import *
from fledge.common import logger
from fledge.services.core.api.service import get_service_records
from fledge.common.common import _FLEDGE_ROOT, _FLEDGE_DATA
+from fledge.common.configuration_manager import ConfigurationManager
__author__ = "Amarendra K Sinha"
@@ -67,10 +68,26 @@ class SupportBuilder:
try:
self.add_syslog_fledge(pyz, file_spec)
self.add_syslog_storage(pyz, file_spec)
+ cf_mgr = ConfigurationManager(self._storage)
+ try:
+ south_cat = await cf_mgr.get_category_child("South")
+ south_categories = [nc["key"] for nc in south_cat]
+ for service in south_categories:
+ self.add_syslog_service(pyz, file_spec, service)
+ except:
+ pass
+ try:
+ north_cat = await cf_mgr.get_category_child("North")
+ north_categories = [nc["key"] for nc in north_cat]
+ for service in north_categories:
+ self.add_syslog_service(pyz, file_spec, service)
+ except:
+ pass
await self.add_table_configuration(pyz, file_spec)
await self.add_table_audit_log(pyz, file_spec)
await self.add_table_schedules(pyz, file_spec)
await self.add_table_scheduled_processes(pyz, file_spec)
+ await self.add_table_statistics_history(pyz, file_spec)
self.add_service_registry(pyz, file_spec)
self.add_machine_resources(pyz, file_spec)
self.add_psinfo(pyz, file_spec)
@@ -123,6 +140,15 @@ class SupportBuilder:
raise RuntimeError("Error in creating {}. Error-{}".format(temp_file, str(ex)))
pyz.add(temp_file, arcname=basename(temp_file))
+ def add_syslog_service(self, pyz, file_spec, service):
+ # The fledge entries from the syslog file
+ temp_file = self._interim_file_path + "/" + "syslog-{}-{}".format(service, file_spec)
+ try:
+ subprocess.call("grep '{}' {} > {}".format(service, _SYSLOG_FILE, temp_file), shell=True)
+ except OSError as ex:
+ raise RuntimeError("Error in creating {}. Error-{}".format(temp_file, str(ex)))
+ pyz.add(temp_file, arcname=basename(temp_file))
+
async def add_table_configuration(self, pyz, file_spec):
# The contents of the configuration table from the storage layer
temp_file = self._interim_file_path + "/" + "configuration-{}".format(file_spec)
@@ -146,6 +172,12 @@ class SupportBuilder:
data = await self._storage.query_tbl("scheduled_processes")
self.write_to_tar(pyz, temp_file, data)
+ async def add_table_statistics_history(self, pyz, file_spec):
+ # The contents of the audit log from the storage layer
+ temp_file = self._interim_file_path + "/" + "statistics-history-{}".format(file_spec)
+ data = await self._storage.query_tbl("statistics_history")
+ self.write_to_tar(pyz, temp_file, data)
+
def add_service_registry(self, pyz, file_spec):
# The contents of the service registry
temp_file = self._interim_file_path + "/" + "service_registry-{}".format(file_spec)
