watchcat: add support for TCP port checking
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 4.6k
- Forks
- 4k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 134
Description
Maintainer: @mips171 (original Roger D <rogerdammit [at] gmail.com>)
Description:
This is an idea to incorporate in the watchcat package the support to check for open TCP ports. The reasons are:
- This package is very small (few text/script files), so it doesn't depends on third party large binaries/libraries.
- The tool has support to execute user scripts. Therefore it could be useful to execute some actions (restart a service for example) if some TCP port is not active (aka not opened).
Based on this I have the objective of use the netcat applet from the busybox tool (nc -z <addr>:<port>) for checking if a TCP port is open. To implement this we only need to add a new "ping" mode and add the port value, and add some code in the script.
My proposal for the configuration:
config watchcat
option mode 'run_script'
option script '/etc/watchcat.user.sh'
option period '6h'
option pinghosts '127.0.0.1'
option pingperiod '30s'
option pingsize 'tcpport' # new value
option pingport '80' # new option
And then regarding the script code it will be necessary only to execute the command nc -z ${pinghosts}:${pingport} instead of the the ping if the "pingsize" option is "tcpport".
You agree with this idea?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the watchcat package and its script code, then read the proposed configuration options and the existing ping behavior. Check how the BusyBox nc command is invoked and how ping failures trigger user scripts. Done means supporting the tcpport value and pingport option while preserving existing modes and checking the documented TCP endpoint.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell
- Domain
- embedded-iot, networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100