Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,36 @@ To install any optional dependencies, such as development dependencies, use:
pip install -e .[dev]
```

### Filling Out Config File
## Making the executable(optional)

Run this in your terminal to create the gecko executable:

## Logs
Logs will have the path to any and all logs you would like to comb upon execution. This includes the system logs on more . This tool with comb the last 24 hours for ERRORS or WARNINGS assuming the log timestamps are formatted as
```bash
time_pattern = r"^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})"
cd gecko
chmod +x gecko
```

You can change this format the the source code if you are familiar with python.
Example Log Path:
### Filling Out Config File

You can run the command below and you will be prompted with questions to fill out the config file. Read promps and answer accordingly:

```bash
FAM_Logs = ~/LOGS/data/devices/FAM/FAM.log
python3 gecko -init
(or ./gecko -init)
```

## System
This holds the information for your Linux system and version.
-TODO: Implent cross platform utility legacy system compatability
### Make Executable avaiable anywhere in the system

Symlink the executable file to bin:

## VNC
Your VNC credentials and all of the sessions the engineers may want screenshots of.
```bash
host = "hostname.outlook.com"
password = "Hello_Sky"
vnc_sessions = 1,2,3,4
sudo ln -s /path/to/repo/Gecko/gecko /usr/local/bin/gecko
```

## Report
Fill out contact information and path to report storage
### Generate a report

## Executing from anywhere
Make sure your global python enviornment has all dependices and move executable into bin
You can now generate gecko reports from any terminal on the machine! (assuming python is available globally)

```bash
./gecko -m "<insert description of bug or instrument failure here>"
```
51 changes: 43 additions & 8 deletions gecko
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,65 @@ import argparse
from triage_package.triage_tool import Triagetools

#Fill out section then run like a CLI executable!###############
CONFIG_PATH = "/home/elijahab/general-dev/gecko/triage_package/triage.ini"
CONFIG_PATH = "triage_package/triage.ini"

################################################################

def run_triage():
'''Executable file for use on the Command line'''
parser = argparse.ArgumentParser(description="Gecko command-line tool")
parser.add_argument(

parser = argparse.ArgumentParser(
description="""
Gecko Triage Tool

A command-line utility to collect system and application logs, take screenshots,
grab science images, and optionally send a compressed report via email.

You can either:
1) Initialize the application (--initialize) to configure settings.
2) Run a triage report (--message "description") to gather logs and send a report.
""",
formatter_class=argparse.RawTextHelpFormatter
)

# Mutually exclusive: either initialize or provide a message
group = parser.add_mutually_exclusive_group(required=True)

group.add_argument(
"-init","--initialize",
action="store_true",
help="Initialize the application"
)

group.add_argument(
"-m", "--message",
type=str,
help="Commit message or description"
help="Run the triage workflow with a message describing the issue. "
"Example: --message 'GPU overheating issue observed today'"
)

args = parser.parse_args()

if args.message:
print(f"Message received: {args.message}")
gecko = Triagetools(config=CONFIG_PATH,message = args.message)
gecko.gather_system_info()
if args.initialize:
gecko = Triagetools(config=CONFIG_PATH, init=True)
print('\nInitialization complete!')
print('You can now run the GUI or use:\n gecko -m "your issue message" \n')

elif args.message:
gecko = Triagetools(config=CONFIG_PATH, message=args.message)
print(f"Running triage workflow for message: {args.message}\n")
gecko.gather_system_info()
gecko.gather_logs()
gecko.comb_logs()
gecko.take_screenshots()
gecko.grab_science_image()
gecko.compress_report()
#gecko.send_report()

#if gecko.email_alerts:
# gecko.send_report()
print("\nTriage workflow complete!")


if __name__ == "__main__":
run_triage()
77 changes: 56 additions & 21 deletions triage_package/triage.ini
Original file line number Diff line number Diff line change
@@ -1,31 +1,66 @@
# Configuration file for Triage Tool
# Only change valus not names of parameters
[System]
#***Does Nothing with this info right now***
os =
help_text =
This section will have ask you to provide your os and version to take not of in the report.
(EXAMPLES)
os: ubuntu
os_version: 24.04


os = ubuntu
os_version =
initialized =

#Path to log file locations
[Logs]
#Example: system = /var/log/syslog
#system = /home/path/to/logging/blue_cal_gammavac.log
help_text =
Please provide the path to your logs and science directory
The logs and science directory should be composed of dated dir in UTC format for the program to iterate through.
(EXAMPLES) In this example latest is symliked to the most current date
logs_dir: /data/latest/logs/
science_dir: /data/latest/


logs_dir =
science_dir =

[Report]
#Enable or disable email alerts
email_alerts=True #***Does Nothing with this info right now***
#Email address to send alerts to
instrument_master_email="" #***Does Nothing with this info right now***
#Where to store generated reports (full path)
report_path= #/home/user/dir/reports
help_text =
This section will ask for details on the reports. If you would not like email notifications, you can just provide a reports path.
(EXAMPLES)
report_path: /home/user/dir/reports
time_pattern: ^(\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?)
email_alerts: false
instrument_master_email: eng@observatory.edu
sender_email: hello@gmail.com
sender_password: password


report_path =
time_pattern = ^(\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?)
email_alerts =
instrument_master_email =
sender_email =
sender_password =

[Machine]
#Threshold for alerting on high CPU usage (in percentage)
cpu_threshold=85 #***Does Nothing with this info right now***
#Threshold for alerting on high Memory usage (in percentage)
memory_threshold=90 #***Does Nothing with this info right now***
help_text =
Please provice percentage thresholds to monitor in the machine system.
(EXAMPLES)
cpu_threshold: 85
memory_threshold: 90


cpu_threshold = 75
memory_threshold = 88

[VNC]
#IP address or host of session
host = #host.provider.com host.iden.edu
password = #Password1234
vnc_sessions = #1,2,3,4,5,12
help_text =
Please provide VNC details:
(EXAMPLES)
host: host.provider.com/host.iden.edu
password: Password1234
vnc_sessions: 1,2,3,4,5,12


host =
password =
vnc_sessions =
Loading