Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
boazhaim committed Nov 17, 2024
1 parent dd43c97 commit 35cca1c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
25 changes: 18 additions & 7 deletions plugins/ufm_log_analyzer_plugin/src/loganalyze/log_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,20 +374,31 @@ def create_analyzer(parsed_args, full_extracted_logs_list,
pdf = PDFCreator(pdf_path, pdf_header, png_images, text_to_show_in_pdf)
# Adding telemetry stats to the PDF
dataframes_for_pdf = []
fabric_info = ibdiagnet_analyzer.get_fabric_size() if ibdiagnet_analyzer else "No Fabric Info found"
fabric_info = ibdiagnet_analyzer.get_fabric_size() \
if ibdiagnet_analyzer else "No Fabric Info found"
dataframes_for_pdf.append(("Fabric info", fabric_info))
if links_flapping_analyzer:
dataframes_for_pdf.append(("Link Flapping past week", links_flapping_analyzer.get_link_flapping_last_week()))
dataframes_for_pdf.append(("Link Flapping past week",
links_flapping_analyzer.get_link_flapping_last_week()))
lists_to_add = []
critical_events_headers = ["timestamp", "event_type", "event", "count"]
lists_to_add.append((event_log_analyzer.get_critical_event_bursts(), "More than 5 events burst over a minute", critical_events_headers))
lists_to_add.append((event_log_analyzer.get_critical_event_bursts(),
"More than 5 events burst over a minute",
critical_events_headers))

for cur_telemetry in \
[ibdianget_2_ports_primary_analyzer, ibdianget_2_ports_secondary_analyzer]:
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} Telemetry iteration time", cur_telemetry.get_last_iterations_time_stats()))
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} Telemetry iteration first and last timestamps", cur_telemetry.get_first_last_iteration_timestamp()))
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} Telemetry fabric size", cur_telemetry.get_number_of_switches_and_ports()))
lists_to_add.append(([cur_telemetry.get_number_of_core_dumps()], f"{cur_telemetry.telemetry_type} number of core dumps found in the logs",["Amount"]))
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} Telemetry iteration time",
cur_telemetry.get_last_iterations_time_stats()))
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} "
"Telemetry iteration first and last timestamps",
cur_telemetry.get_first_last_iteration_timestamp()))
dataframes_for_pdf.append((f"{cur_telemetry.telemetry_type} Telemetry fabric size",
cur_telemetry.get_number_of_switches_and_ports()))
lists_to_add.append(([cur_telemetry.get_number_of_core_dumps()],
f"{cur_telemetry.telemetry_type} "
"number of core dumps found in the logs",
["Amount"]))


# PDF creator gets all the images and to add to the report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# provided with the software product.
#

import os
from typing import List
import warnings
import pandas as pd
Expand Down Expand Up @@ -113,7 +112,7 @@ def analyze_iteration_time(self, threshold=0.15):
filtered_data = filtered_data[filtered_data['data'] >= threshold]
filtered_data['timestamp'] = pd.to_datetime(filtered_data['timestamp'], errors='coerce')
filtered_data = filtered_data.dropna(subset=['timestamp'])

filtered_data = filtered_data.sort_values(by='timestamp').reset_index(drop=True)

if not filtered_data['data'].empty:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,5 @@ def create_pdf(self, data_frames_with_titles, lists_to_add):
# Output the final PDF
# Add text section
self.add_text()

self.output(self._pdf_path)

0 comments on commit 35cca1c

Please sign in to comment.