Skip to content

Commit

Permalink
First version of app
Browse files Browse the repository at this point in the history
  • Loading branch information
debek committed Dec 24, 2023
1 parent d740f0e commit fdbc99c
Show file tree
Hide file tree
Showing 23 changed files with 853 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Continuous Integration

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.5

- name: Build
run: go build -v ./...

- name: Run tests
run: go test -v ./...
29 changes: 29 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
version:
description: 'Version (e.g., 1.0.0)'
required: true

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21.5

- name: Run GoReleaser
if: github.event_name == 'workflow_dispatch'
run: goreleaser release --rm-dist --release-notes "Release version ${{ github.event.inputs.version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25 changes: 22 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
osmon

# Test binary, built with `go test -c`
*.test
Expand All @@ -19,3 +17,24 @@

# Go workspace file
go.work

# Ignore JetBrains IntelliJ IDEA project files
.idea/

# Ignore Visual Studio Code project files
.vscode/

# Ignore temporary directories and files
.idea/
.vscode/
.idea_modules/
.idea_caches/
out/
.idea.vim/
.idea_workspace/

# Ignore project files generated by IntelliJ IDEA
*.iml
*.ipr
*.iws
*.idea_modules
54 changes: 54 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# .goreleaser.yml
# This is the GoReleaser configuration file which defines how to build, package, and release your application.

project_name: osmon # The name of your project.

# Build section defines how your application should be built.
builds:
- id: osmon
main: . # Path to the main source file or directory of your program.
binary: osmon # Name of the compiled binary.
goos: # List of target operating systems.
- linux
- darwin
goarch: # List of target architectures.
- amd64
- arm64
env: # Environment variables to be set during the build process.
- CGO_ENABLED=0
ldflags: # Flags to pass to the go compiler.
- -s -w

# Archives section defines how to package your binary.
archives:
- id: archive
builds:
- osmon
format: tar.gz # Format for Linux binaries.
format_overrides:
- goos: darwin
format: zip # Format for macOS binaries.
wrap_in_directory: true
files: # Additional files to include in the archive.
- LICENSE
- README.md

# Release section configures how to handle GitHub releases.
release:
github:
owner: debek
name: osmon
draft: true # Indicates whether the release should be a draft.
prerelease: auto # Automatically set whether the release is a prerelease based on the tag.

# Checksum section generates checksums of your binaries.
checksum:
name_template: 'checksums.txt'

# Snapshot section configures the creation of snapshots.
snapshot:
name_template: "{{ .Tag }}-next" # Template for naming snapshot releases.

# Changelog section configures how the changelog should be handled.
changelog:
skip: false # Indicates whether to skip generating the changelog.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/aws.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/osmon.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions CONTRIBUTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing to osmon

Thank you for your interest in contributing to osmon! All contributions, whether code, bug reports, or feature suggestions, are greatly appreciated.

## How Can I Contribute?

### Reporting Bugs and Suggesting Features
- If you encounter a bug or have an idea for a new feature, please create an issue in our GitHub repository.
- Describe the bug or feature as detailed as possible to help us understand your intentions.

### Creating Pull Requests
- Fork the repository.
- Create a new branch for your changes (`git checkout -b my-new-feature`).
- Make your changes in the code.
- Ensure code is well-formatted and follows the project's coding standards.
- Commit your changes (`git commit -am 'Add some feature'`).
- Push to your fork (`git push origin my-new-feature`).
- Submit a Pull Request to our repository.

### Guidelines
- Make sure your changes are well documented.
- Add tests for new features.
- Follow the established coding standards.

## Coding and Testing
- We encourage clear and understandable coding.
- Unit tests are an essential part of development. Try to maintain high test coverage.

## Questions?
If you have any questions or concerns, don't hesitate to ask. We are here to help!

Thank you for your contributions to the osmon project!
107 changes: 107 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# osmon

**osmon** is a command-line tool written in Go that provides quick access to basic system information. With **osmon**, you can easily access details such as your host's IP address, system load, memory usage, logged-in users, and much more.

## Features

- Displaying your host's name and IP address.
- Showing the current system load averages.
- Overview of memory usage statistics, including total memory, used memory, and available memory.
- Listing logged-in users and their respective terminals.

[//]: # (## Demo Video)

[//]: # ()
[//]: # (Check out this demo of **osmon** in action:)

[//]: # ()
[//]: # ([![Demo Video](http://img.youtube.com/vi/ID_TWOJEGO_FILMU/0.jpg)](http://www.youtube.com/watch?v=ID_TWOJEGO_FILMU "osmon Demo"))

## Applications

### Monitoring After SSH Login

**osmon** is an ideal tool for a quick overview of a server's status upon SSH login. You can configure your shell to automatically run `osmon` every time you log in, providing an immediate snapshot of the server's status.

Example:

- Configure your `.bashrc` or `.zshrc` to run `osmon` upon every login, allowing you to immediately assess the state of the server.

### Debugging

**osmon** can be an invaluable tool for debugging performance issues. By running `osmon`, you can quickly identify if high system load is caused by memory, CPU, or network activity.

Example:

- If you notice that your application is running slower than usual, you can use `osmon` to check if the system is under heavy load.

### Installation

You can install **osmon** using the Go tool:


`go install github.com/yourusername/osmon@latest`

After installation, add the Go binary path to your system's PATH to access the `osmon` command from anywhere:


`export PATH=$PATH:~/go/bin`

### Usage

**osmon** offers various command-line options for tailored usage. Below are the available flags and their descriptions:

- `-h`: Display help information. \[...\]
- `-v`: Display the version of the application. \[...\]
- `-i` or `--interval`: Set the interval for refreshing the display in seconds. \[...\]

#### Basic Usage

To simply display the system information, run the `osmon` command without any flags:


`osmon`

#### Continuous Monitoring

If you want to continuously monitor your system's status with a specific refresh interval, use the `-i` flag with your desired interval in seconds:


```bash
osmon -i 5
```

### Binary Release Installation (Optional)

If you release a binary version of **osmon**, users can follow these steps:

1. Download the binary from the "Releases" section of your GitHub repository.

2. Move the binary to a directory in your PATH, for example, `/usr/local/bin`:


1. `mv osmon /usr/local/bin/osmon chmod +x /usr/local/bin/osmon`


## Compatibility

- **osmon** is compatible with Linux and macOS systems.

## Contributing

If you're interested in contributing to the osmon project, please check our [contribution guidelines](https://chat.openai.com/g/g-yxXXjJ1If-it-gpt4/c/CONTRIBUTE.md). All contributions, from bug reporting to new feature suggestions, are highly appreciated.

## License

This project is available under the [MIT License](https://chat.openai.com/g/g-yxXXjJ1If-it-gpt4/c/0c1a0ed0-de56-4ded-8159-e19be6cae7bc).

## Acknowledgments

Special thanks to the Go community for creating excellent libraries like `github.com/shirou/gopsutil`, which make it easier to gather system information.

## TO DO

- **Information about IOBS and IOPS**: Include details about read and write operations, and possibly any limits.
- **Outgoing and Incoming Connections**: Display connections in kilobits or megabits.
- **Number of Connections**: Show the count of incoming and outgoing connections.
- **Kernel Version**: Add information about the kernel version.
Loading

0 comments on commit fdbc99c

Please sign in to comment.