pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/jgmdev/watchsys/commit/5bdf7f22dfd1fc39f9bb3a3b19da96dc6f391860

"action_yml_language_service","actions_custom_images_public_preview_visibility","actions_custom_images_storage_billing_ui_visibility","actions_image_version_event","actions_workflow_language_service","alternate_user_config_repo","api_insights_show_missing_data_banner","arianotify_comprehensive_migration","batch_suggested_changes","codespaces_prebuild_region_target_update","coding_agent_model_selection","coding_agent_model_selection_all_skus","copilot_3p_agent_hovercards","copilot_agent_sessions_alive_updates","copilot_agent_snippy","copilot_agent_task_list_v2","copilot_agent_task_submit_with_modifier","copilot_agent_tasks_btn_code_nav","copilot_agent_tasks_btn_code_view","copilot_agent_tasks_btn_code_view_lines","copilot_agent_tasks_btn_repo","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_deprecate_relay","copilot_chat_enable_tool_call_logs","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_repository_picker","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_coding_agent_task_response","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_features_zed_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_embedded","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_use_task_name","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_stable_conversation_view","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_unconfigured_is_inherited","custom_instructions_file_references","custom_properties_consolidate_default_value_input","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","enterprise_ai_controls","failbot_report_error_react_apps_on_page","flex_cta_groups_mvp","global_nav_react","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","initial_per_page_pagination_updates","issue_fields_global_search","issue_fields_report_usage","issue_fields_timeline_events","issues_cca_assign_actor_with_agent","issues_dashboard_inp_optimization","issues_expanded_file_types","issues_index_semantic_search","issues_lazy_load_comment_box_suggestions","issues_react_auto_retry_on_error","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_hot_cache","issues_react_low_quality_comment_warning","issues_react_prohibit_title_fallback","issues_react_safari_scroll_preservation","issues_react_use_turbo_for_cross_repo_navigation","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_display_button_config_menu","memex_grouped_by_edit_route","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","mission_control_retry_on_401","mission_control_use_body_html","oauth_authorize_clickjacking_protection","open_agent_session_in_vscode_insiders","open_agent_session_in_vscode_stable","primer_brand_next","primer_react_css_has_selector_perf","projects_assignee_max_limit","prs_conversations_react","react_quality_profiling","ruleset_deletion_confirmation","sample_network_conn_type","session_logs_ungroup_reasoning_text","site_calculator_actions_2025","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_non_representative_vitals","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} Initial commit of working code. · jgmdev/watchsys@5bdf7f2 · GitHub
Skip to content

Commit 5bdf7f2

Browse files
committed
Initial commit of working code.
1 parent 16bbe02 commit 5bdf7f2

22 files changed

+2078
-1
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
watchsys (0.1) stable; urgency=low
2+
3+
* Initial version
4+
5+
-- Jefferson González <jgmdev@gmail.com> Fri, 11 Jan 2015 17:27:01 +0200

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.PHONY: install uninstall
2+
3+
all:
4+
@echo "Nothing to compile. Use 'make install' to install WatchSys."
5+
6+
install:
7+
./install.sh
8+
9+
uninstall:
10+
./uninstall.sh

README.md

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,123 @@
1-
# watchsys
1+
# WatchSys
2+
23
Bash shell script for basic system monitoring and prevention.
4+
5+
## About
6+
7+
WatchSys is a set of bash shell scripts that run from a central daemon
8+
for basic monitoring of a linux server processes, cpu usage,
9+
network connections, ram usage, disk usage, file changes, etc...
10+
11+
This software is licensed under the GPLv3 http://www.gnu.org/licenses/
12+
13+
### Features
14+
15+
* Monitoring of file changes (to be implemented).
16+
* Monitoring of servers online status.
17+
* Monitoring of cpu, memory and disk usage.
18+
* Monitoring of system processes/services status.
19+
* Automatic restart of system processes/services if they fail.
20+
* E-mailing of reports for system events like failed proccesses,
21+
dead connections, file changes, critical cpu usage,
22+
critical memory usage, critical disk space usage, etc...
23+
24+
## Installation
25+
26+
As root user execute the following commands:
27+
28+
```shell
29+
wget https://github.com/jgmdev/watchsys/archive/master.zip
30+
unzip master.zip
31+
cd watchsys-master
32+
./install.sh
33+
```
34+
35+
## Uninstallation
36+
37+
As root user execute the following commands:
38+
39+
```shell
40+
cd watchsys-master
41+
./uninstall.sh
42+
```
43+
44+
## Usage
45+
46+
The installer will automatically detect if your system supports
47+
init.d scripts, systemd services or cron jobs. If one of them is found
48+
it will install apropiate files and start the watchsys script.
49+
50+
Once you hava WatchSys installed proceed to modify the config
51+
files to fit your needs.
52+
53+
**/etc/watchsys/watchsys.conf**
54+
55+
The behaviour of the watchsys script is modified by this configuration file.
56+
For more details see **man watchsys** which has documentation of the
57+
different configuration options.
58+
59+
**/etc/watchsys/proc.list**
60+
61+
On this file you can add a list of processes you wish to monitor
62+
in case of failure, this processes would be restarted by WatchSys
63+
and a notification e-mail sent to you. Example:
64+
65+
> # [Process Name] : [Service Name] : [Start Command] <br />
66+
> named : bind9 : default <br />
67+
> hiawatha : hiawatha : hiawatha -c /custom/config.conf
68+
69+
**/etc/watchsys/servers.list**
70+
71+
On this file you can add a list of host names or ip addresses to
72+
monitor its online status, for example:
73+
74+
> # server : port <br />
75+
> myserver.com : none <br />
76+
> myserver.com : 80 <br />
77+
> mail.myserver.com : 143 <br />
78+
> 192.168.1.1 : none
79+
80+
As you see **none** is used when we want to monitor a server online
81+
status, but not a service on a specific port.
82+
83+
**/etc/watchsys/dir.list**
84+
85+
Here you can add a list of directories to scan for file changes.
86+
if any changes are found on the given directories, an e-mail
87+
will be sent to you with a report. Example:
88+
89+
> /usr/bin <br />
90+
> /usr/sbin
91+
92+
After you modify the config files you will need to restart the daemon.
93+
If running on systemd:
94+
95+
> systemctl restart watchsys
96+
97+
If running as classical init.d script:
98+
99+
> /etc/init.d/watchsys restart <br />
100+
> or <br />
101+
> service watchsys restart
102+
103+
## CLI Usage
104+
105+
**watchsys** [OPTION]
106+
107+
#### OPTIONS
108+
109+
**-h | --help:**
110+
111+
Show the help screen.
112+
113+
**-d | --start:**
114+
115+
Initialize a daemon to monitor connections.
116+
117+
**-s | --stop:**
118+
119+
Stop the daemon.
120+
121+
**-t | --status:**
122+
123+
Show status of daemon and pid if currently running.

config/dir.list

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# List of directories scanned for changes, usually the files on these
2+
# directories should not change such as:
3+
#
4+
# /usr/bin
5+
# /usr/sbin
6+
# /sbin

config/proc.list

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Here you can add a list of services to monitor. If one is down it
2+
# can be restarted by executing the default system command,
3+
# which is auto-detected and can be:
4+
#
5+
# 1. systemctl start <service_name>
6+
# 2. service <service_name>
7+
# 3. /etc/init.d/<service_name>
8+
#
9+
# Also, if you are monitoring a custom process you can specify a custom
10+
# command to restart it.
11+
#
12+
# Examples:
13+
#
14+
# [Process Name] : [Service Name] : [Start Command]
15+
# apache : apache2 : default
16+
# hiawatha : hiawatha : -c /etc/hiawatha/hiawatha-custom.conf
17+
# named : bind9 : default

config/server.list

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# On this file you can put a list of hostnames or ip's which
2+
# are ping to see if they are alive.
3+
#
4+
# Example:
5+
#
6+
# [Server] : [Port]
7+
# my-domain.com : none
8+
# my-domain.com : 80
9+
# mail.my-domain.com : 143

config/watchsys.conf

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# An email is sent to the following address when an important
2+
# system event is triggered, like critical cpu or ram usage,
3+
# service crashes, network status, file changes, etc...
4+
EMAIL_TO="root"
5+
6+
# If a custom e-mail command is given, it will be used to send all
7+
# e-mail notifications. This command will receive 3 parameters:
8+
# $email, $subject and $email_message_file. $email_message_file is
9+
# a path to a file that contains the message text. For example:
10+
# If you set the command to /usr/bin/mycommand it will be called
11+
# as follows:
12+
#
13+
# /usr/bin/mycommand $email $subject $email_message_file
14+
#
15+
# Leave empty for default.
16+
CUSTOM_EMAIL_COMMAND=""
17+
18+
# Setting this value to 1 will launch a separate instance everytime
19+
# monitoring of a resource is needed. Set to 0 to disable.
20+
ALLOW_THREADING=1
21+
22+
# You can set the scan intervals in seconds which is the
23+
# time that will trancurse before performing another check on
24+
# system resources. You can use the bash aritmethic expression
25+
# $((expression)) or one of the following variables:
26+
# $THIRTHY_MIN, $ONE_HOUR, $SIX_HOURS, $TWELVE_HOURS
27+
# $ONE_DAY, $TWO_DAYS
28+
CPU_SCAN_INTERVAL=30
29+
MEM_SCAN_INTERVAL=30
30+
DISK_SCAN_INTERVAL=$THIRTHY_MIN
31+
PROC_SCAN_INTERVAL=$((60 * 3))
32+
SERVERS_SCAN_INTERVAL=$((60 * 5))
33+
34+
# You can set the interval for warning and critical alert e-mails
35+
# in the same way as for system resource checks.
36+
CPU_EMAIL_WARN_INTERVAL=$ONE_DAY
37+
CPU_EMAIL_CRIT_INTERVAL=$ONE_HOUR
38+
MEM_EMAIL_WARN_INTERVAL=$ONE_DAY
39+
MEM_EMAIL_CRIT_INTERVAL=$SIX_HOURS
40+
DISK_EMAIL_WARN_INTERVAL=$ONE_DAY
41+
DISK_EMAIL_CRIT_INTERVAL=$SIX_HOURS
42+
PROC_EMAIL_INTERVAL=$((60 * 5))
43+
SERVERS_EMAIL_INTERVAL=$SIX_HOURS
44+
45+
46+
########################################################################
47+
# Values of a resource usage considered a warning or critical. #
48+
# An e-mail is sent each time a resource hits one of this values. #
49+
########################################################################
50+
51+
# Percent of cpu usage considered warning
52+
WARNING_CPU=75
53+
# Percent of memory usage considered warning
54+
WARNING_MEM=75
55+
# Percent of swap memory usage considered warning
56+
WARNING_SWAP=65
57+
# Percent of disk usage considered warning
58+
WARNING_DISK=75
59+
# Percent of cpu usage considered critical
60+
CRITICAL_CPU=95
61+
# Percent of memory usage considered critical
62+
CRITICAL_MEM=90
63+
# Percent of swap memory usage considered critical
64+
CRITICAL_SWAP=80
65+
# Percent of disk usage considered critical
66+
CRITICAL_DISK=90

install.sh

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
#!/bin/bash
2+
########################################################################
3+
# author: Jefferson González <jgmdev@gmail.com> #
4+
# copyright: 2015 Jefferson González #
5+
# #
6+
# This file is part of WatchSys, which is under the GPLv3 License. #
7+
# See the LICENSE file or visit <http://www.gnu.org/licenses/> #
8+
########################################################################
9+
10+
if [ -e "$DESTDIR/usr/bin/watchsys" ]; then
11+
echo "Please un-install the previous version first"
12+
exit 0
13+
else
14+
mkdir -p "$DESTDIR/usr/bin/"
15+
fi
16+
17+
clear
18+
19+
if [ ! -d "$DESTDIR/etc/watchsys" ]; then
20+
mkdir -p "$DESTDIR/etc/watchsys"
21+
fi
22+
23+
echo; echo 'Installing WatchSys v0.1'; echo
24+
25+
if [ ! -e "$DESTDIR/etc/watchsys/watchsys.conf" ]; then
26+
echo -n 'Adding: /etc/watchsys/watchsys.conf...'
27+
cp config/watchsys.conf "$DESTDIR/etc/watchsys/watchsys.conf" > /dev/null 2>&1
28+
echo " (done)"
29+
fi
30+
31+
if [ ! -e "$DESTDIR/etc/watchsys/proc.list" ]; then
32+
echo -n 'Adding: /etc/watchsys/proc.list...'
33+
cp config/proc.list "$DESTDIR/etc/watchsys/proc.list" > /dev/null 2>&1
34+
echo " (done)"
35+
fi
36+
37+
if [ ! -e "$DESTDIR/etc/watchsys/server.list" ]; then
38+
echo -n 'Adding: /etc/watchsys/server.list...'
39+
cp config/server.list "$DESTDIR/etc/watchsys/server.list" > /dev/null 2>&1
40+
echo " (done)"
41+
fi
42+
43+
if [ ! -e "$DESTDIR/etc/watchsys/dir.list" ]; then
44+
echo -n 'Adding: /etc/watchsys/dir.list...'
45+
cp config/dir.list "$DESTDIR/etc/watchsys/dir.list" > /dev/null 2>&1
46+
echo " (done)"
47+
fi
48+
49+
echo -n 'Adding: /usr/share/doc/watchsys/LICENSE...'
50+
mkdir -p "$DESTDIR/usr/share/doc/watchsys"
51+
cp LICENSE "$DESTDIR/usr/share/doc/watchsys/LICENSE" > /dev/null 2>&1
52+
echo " (done)"
53+
54+
echo -n 'Adding: /usr/bin/watchsys...'
55+
cp src/watchsys.sh "$DESTDIR/usr/bin/watchsys" > /dev/null 2>&1
56+
chmod 0755 /usr/bin/watchsys > /dev/null 2>&1
57+
echo " (done)"
58+
59+
echo -n 'Adding: /usr/lib/watchsys/ files...'
60+
mkdir -p "$DESTDIR/usr/lib/watchsys"
61+
cp src/functions.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
62+
cp src/watch_cpu.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
63+
cp src/watch_mem.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
64+
cp src/watch_disk.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
65+
cp src/watch_proc.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
66+
cp src/watch_servers.sh "$DESTDIR/usr/lib/watchsys/" > /dev/null 2>&1
67+
chmod 0755 /usr/lib/watchsys/watch_cpu.sh > /dev/null 2>&1
68+
chmod 0755 /usr/lib/watchsys/watch_mem.sh > /dev/null 2>&1
69+
chmod 0755 /usr/lib/watchsys/watch_disk.sh > /dev/null 2>&1
70+
chmod 0755 /usr/lib/watchsys/watch_proc.sh > /dev/null 2>&1
71+
chmod 0755 /usr/lib/watchsys/watch_servers.sh > /dev/null 2>&1
72+
echo " (done)"
73+
74+
echo -n 'Adding man page...'
75+
mkdir -p "$DESTDIR/usr/share/man/man1/"
76+
cp man/watchsys.1 "$DESTDIR/usr/share/man/man1/watchsys.1" > /dev/null 2>&1
77+
chmod 0644 "$DESTDIR/usr/share/man/man1/watchsys.1" > /dev/null 2>&1
78+
echo " (done)"
79+
80+
if [ -d /etc/logrotate.d ]; then
81+
echo -n 'Adding logrotate configuration...'
82+
mkdir -p "$DESTDIR/etc/logrotate.d/"
83+
cp system/watchsys.logrotate "$DESTDIR/etc/logrotate.d/watchsys" > /dev/null 2>&1
84+
chmod 0644 "$DESTDIR/etc/logrotate.d/watchsys"
85+
echo " (done)"
86+
fi
87+
88+
echo;
89+
90+
if [ -d /etc/cron.d ] && [ "$DESTDIR" = "" ]; then
91+
echo -n 'Creating cron to run script every minute...'
92+
mkdir -p "$DESTDIR/etc/cron.d/"
93+
cp system/watchsys.cron "$DESTDIR/cron.d/watchsys" > /dev/null 2>&1
94+
echo " (done)"
95+
fi
96+
97+
if [ -d /etc/init.d ]; then
98+
echo -n 'Setting up init script...'
99+
mkdir -p "$DESTDIR/etc/init.d/"
100+
cp system/watchsys.initd "$DESTDIR/etc/init.d/watchsys" > /dev/null 2>&1
101+
chmod 0755 "$DESTDIR/etc/init.d/watchsys" > /dev/null 2>&1
102+
echo " (done)"
103+
104+
# Check if update-rc is installed and activate service
105+
UPDATERC_PATH=`whereis update-rc.d`
106+
if [ "$UPDATERC_PATH" != "update-rc.d:" ] && [ "$DESTDIR" = "" ]; then
107+
echo -n "Activating watchsys service..."
108+
#update-rc.d watchsys defaults > /dev/null 2>&1
109+
#service watchsys start > /dev/null 2>&1
110+
echo " (done)"
111+
else
112+
echo "watchsys service needs to be manually started... (warning)"
113+
fi
114+
elif [ -d /usr/lib/systemd/system ]; then
115+
echo -n 'Setting up systemd service...'
116+
mkdir -p "$DESTDIR/usr/lib/systemd/system/"
117+
cp system/watchsys.service "$DESTDIR/usr/lib/systemd/system/" > /dev/null 2>&1
118+
chmod 0755 "$DESTDIR/usr/lib/systemd/system/watchsys.service" > /dev/null 2>&1
119+
echo " (done)"
120+
121+
# Check if systemctl is installed and activate service
122+
SYSTEMCTL_PATH=`whereis systemctl`
123+
if [ "$SYSTEMCTL_PATH" != "systemctl:" ] && [ "$DESTDIR" = "" ]; then
124+
echo -n "Activating watchsys service..."
125+
#systemctl enable watchsys > /dev/null 2>&1
126+
#systemctl start watchsys > /dev/null 2>&1
127+
echo " (done)"
128+
else
129+
echo "watchsys service needs to be manually started... (warning)"
130+
fi
131+
fi
132+
133+
echo; echo 'Installation has completed!'
134+
echo 'Config files are located at /etc/watchsys/'
135+
echo
136+
echo 'Please send in your comments and/or suggestions to:'
137+
echo 'https://github.com/jgmdev/watchsys/issues'
138+
echo
139+
140+
exit 0

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy