Commit Graph

48 Commits

Author SHA1 Message Date
MicLieg
181c84508d
feat(alerts): add support for telegram thread/topic ids (#4526) 2024-03-08 22:03:23 +00:00
Daniel Gibbs
120023dcae
feat: alerts refactor (#4345)
* feat(alert): add new alert types

- Added new alert types for different scenarios such as stopped, started, restarted, monitor session failure, monitor query failure, wipe, and info.
- Updated the `alert.sh` script to include functions for each new alert type.
- Modified the `command_monitor.sh` script to use the appropriate alert type based on the monitoring results.

* feat: remove more info if not enabled

* refactor: refactor alert functions and add color codes

This commit refactors the alert functions in the `alert.sh` module. It adds color codes for different types of alerts, such as green for started/restarted alerts, red for stopped/monitor session/query/permissions alerts, and blue for update/config/wipe/info alerts. The commit also updates the alert emoji to better represent each type of alert.

* feat: add colour to discord alert

* refactor: improve Pushbullet alert sending

The code in the `alert_pushbullet.sh` file has been refactored to improve the way Pushbullet alerts are sent. The curl command now includes the access token as a header instead of in the URL, resulting in more secure communication with the Pushbullet API. This change enhances the reliability and security of sending Pushbullet alerts.

* feat: add alert icon and footer to Discord alerts

- Added a new variable `alerticon` to store the URL of the alert icon image.
- Included the `alerticon` in the JSON payload for both short info and no info alerts.
- Added a footer with text "Sent by LinuxGSM v23.5.3" to the JSON payload for both short info and no info alerts.

This commit enhances the appearance of Discord alerts by adding an icon, a footer, and additional information about the sender.

* refactor(alert): refactor alert functions

- Refactored the alert functions to improve code readability and maintainability.
- Renamed variables for better clarity and consistency.
- Updated function names to be more descriptive of their purpose.
- Reorganized the order of function definitions for better organization.

* feat: add first batch of icons

* refactor: improve serverlist validation script

The commit refactors the serverlist validation script to include a new check. It now compares all game servers listed in `serverlist.csv` to `$shortname-icon.png` files in `lgsm/data/gameicons`. If a game server is listed in `serverlist.csv`, it should have a corresponding `$shortname-icon.png` file. The commit adds a loop that checks for the existence of these files and outputs an error message if any are missing.

* another batch of icons

* more icons

* updated icons

a

* feat: add serverlist game icon validation

This commit adds a new script `serverlist-validate-game-icons.sh` that checks if all the game servers listed in `serverlist.csv` have a corresponding `shortname-icon.png` file. It also verifies that the number of game icons matches the number of servers in `serverlist.csv`. The script is executed as part of the workflow defined in `serverlist-validate.yml`.

Co-authored-by: [co-author-name]

* refactor: improve game icon validation script

The commit refactors the game icon validation script to improve its functionality. It adds a check for unexpected game icons and ensures that the number of game icons matches the number of servers in serverlist.csv. The commit also updates error messages for better clarity and readability.

* refactor: remove unused mumble-icon.png game icon

The code changes involve removing the unused mumble-icon.png game icon. This change helps to clean up the codebase by removing unnecessary files.

* feat: update game icons

Updated the game icons for bf1942, pmc, vints, vpmc, and wmc. Changed resolution to 32px

* feat(alert): add alert action and information to Discord message

- Added a new variable `alertaction` to store the action performed in the alert
- Modified the Discord message template to include the alert action and information
- Updated the author name in the Discord message template to "LinuxGSM Alert"

The changes allow for more informative and descriptive alerts in Discord messages.

* feat(alert.sh): add alertaction variable

This commit adds the `alertaction` variable to the `fn_alert_*` functions in the `alert.sh` module. The `alertaction` variable is used to specify the action that triggered the alert, such as "Started", "Stopped", "Restarted", etc. This allows for more informative and descriptive alerts.

* refactor: rework email alert

* feat: add environment detail

* refactor: simplify Discord and Pushbullet alert message handling

The code changes in this commit refactor the way Discord and Pushbullet alert messages are handled. The previous implementation used separate variables for short information and no information scenarios, but now it uses a single variable for both cases. Additionally, the code now checks if the "alerturl" is empty instead of comparing it to a specific value.

These changes improve code readability and maintainability by reducing redundancy and simplifying conditional logic.

* title

* fix: update Pushover alert message formatting

The commit fixes the formatting of the Pushover alert message by removing unnecessary information and adding a conditional check for the presence of an alert URL.

* refactor: improve formatting of server IP value in Discord alert

The code changes in this commit refactor the formatting of the server IP value in the Discord alert. The value is now enclosed in single quotes for better readability.

* refactor: improve alert message formatting and remove unnecessary code

The commit refactors the alert message formatting in the `alert_pushbullet.sh`, `alert_slack.sh`, and `alert_telegram.sh` files. It improves the structure and readability of the messages by using proper markdown syntax. Additionally, it removes unnecessary code from the files to simplify their implementation.

* more changes

* feat: add server name and information fields to Discord alert

The code changes in the `alert_discord.sh` file include adding new fields for server name and information to the JSON payload sent in a Discord alert. This allows for more detailed information about the server to be included in the alert message.

refactor: improve conditional logic for Gotify alerts

In the `alert_gotify.sh` file, the code changes involve improving the conditional logic for determining which JSON payload to use when sending a Gotify alert. The updated logic checks if an alert URL is provided and selects the appropriate JSON payload accordingly.

chore: update field names in IFTTT alerts

The changes made in `alert_ifttt.sh` involve updating field names in the JSON payloads used for IFTTT alerts. The field names have been modified to match a consistent format across all fields.

fix: correct body formatting in Pushbullet alerts

The code changes made in `alert_pushbullet.sh` address an issue with incorrect body formatting in Pushbullet alerts. The body of the alert now includes separate lines for each piece of information, such as server name, information, game, server IP, hostname, and more info.

refactor: improve attachment structure in RocketChat alerts

In `alert_rocketchat.sh`, the code changes involve improving the attachment structure of RocketChat alerts. The updated structure includes separate sections for server name, information, game, server IP, hostname, and more info.

feat: add additional sections to Slack alerts

The changes made in `alert_slack.sh` include adding additional sections to Slack alerts. These sections provide separate blocks of text for server name and information within each message.

feat: add HTML formatting to Telegram alerts

In `alert_telegram.sh`, HTML formatting has been added to Telegram alerts. This allows for bold text styling and clickable links within each message sent via Telegram.

* bug

* bug

* refactor: improve alert message formatting

- Refactored the code in `alert_pushover.sh` and `alert_telegram.sh` to improve the formatting of the alert messages.
- Updated the message structure to include the server name before other information.
- Added line breaks for better readability.
- Made sure that all variables are properly interpolated within the messages.

* bug

* remove rocketchattoken

* feat: add alert types for server start, stop, restart, and wipe

- Added new alert types for server start, stop, restart, and wipe.
- Updated the `alert.sh` module to include functions for handling these new alert types.
- Modified the `command_start.sh`, `command_stop.sh`, and `command_wipe.sh` modules to trigger the corresponding alerts when appropriate.
- Updated the `alert_rocketchat.sh` module to display the relevant information for each alert type in Rocket.Chat notifications.

* refactor: update alert messages in lgsm/modules/alert.sh

- Updated the alert messages for when the game server is stopped, started, restarted, and when an LinuxGSM update is received.
- Changed the wording to use "has been" instead of "has" for consistency.
- Added a mention that the server has been restarted after receiving an LinuxGSM update.

* bug

* refactor: update alert emojis and add server time

- Updated the alert emojis in the `alert.sh` module.
- Added the server time to the alert messages in various modules (`alert_discord.sh`, `alert_gotify.sh`, `alert_ifttt.sh`, `alert_pushbullet.sh`, `alert_pushover.sh`, `alert_rocketchat.sh`, and `alert_slack.sh`).

* refactor: remove date from alert messages

The commit refactors the code in `alert_discord.sh` and `alert_slack.sh` to remove the date from the alert messages sent by LinuxGSM. This change simplifies the message content while still indicating that it was sent by LinuxGSM and includes the version number.

* feat: add statusalert option to server configs

This commit adds the "statusalert" option to the default configuration files for various game servers. The "statusalert" option allows users to enable or disable alerts on server start, stop, and restart events. This feature provides more flexibility in managing server notifications.

* feat: add alert for update and restart if necessary

The code change adds an alert for updates and restarts the service if necessary. This ensures that the service is restarted after an update to prevent any issues.

* feat: add backup alert functionality

This commit adds a new function `fn_alert_backup` to the `alert.sh` module. This function sends an alert when the system has been backed up. The alert includes a message, action, emoji, sound, and color.

In addition, this commit modifies the `command_backup.sh` module to trigger the backup alert by setting the variable `alert` to "backup" and calling `alert.sh`.

The purpose of these changes is to provide notifications when backups are created.

Co-authored-by: AI Assistant <assistant@example.com>

* refactor: change alert color to green

The code in the `alert.sh` file has been refactored to change the alert color from blue to green. This change updates the `alertcolourhex` and `alertcolourdec` variables accordingly.

---------

Co-authored-by: AI Assistant <assistant@example.com>
2023-10-22 21:47:18 +01:00
Daniel Gibbs
099412730c
feat(alerts): deprecate mailgun (#4324)
mailgun is no longer free and stats suggest it is not used at all. Removing support
2023-10-01 23:21:01 +01:00
Daniel Gibbs
6726772bb1 refactor: update log directory configuration
The log directory configuration has been updated for multiple game servers. The LGSM_LOGDIR environment variable is now checked and used if available, otherwise the default root directory is used. This change ensures that the correct log directories are set for each server.
2023-07-05 11:18:33 +01:00
Reda DRISSI
69468d333a
feat(core): prefix logs with a timestamp (#3795)
* feat: Added Option to prefix logs with timestamps

* feat: Added Option to prefix logs with timestamps

* Add parameters to every game

* feat: Switched timestamp enabling from True/False to on/off

* feat: Added quotes on variables

* add to new configs

* renamed to logtimestamp

* remove gawk as a requirement

gawk is a standard tool on linux distros and no check is required

* tidy

* rename to addtimestamp

---------

Co-authored-by: Reda.drissi.e <reda.drissi.e@thalesdigital.io>
Co-authored-by: Daniel Gibbs <me@danielgibbs.co.uk>
2023-03-28 22:09:16 +01:00
jamiew0w
436c87de19
feat(alerts): add Gotify support to alerts (#3509)
* added gotify to default configs

* added gotify to info_messages.sh

* added gotify to core_function.sh

* added gotify to alerts.sh

* core of alert_gotify.sh

* fixed unterminated string in default configs

* fixed mistakes in alert_gotify.sh

* fixed bad quoting in alert_gotify.sh

* first working version, gotify does not like emojis

* added back curl options

* added catch for $gotifywebhook to alert.sh

* tabs over spaces

* standardised json

* message

Co-authored-by: Daniel Gibbs <me@danielgibbs.co.uk>
2021-09-14 22:20:10 +01:00
RuioWolf
2310d9e510
feat(alert): add an option to use a reverse proxied Telegram API server. (#3228) 2021-02-19 23:07:00 +00:00
Daniel Gibbs
db2a769f2d feat: improved start parameters system (#3151)
Significant refactor of start parameters that removed the need for a function in LinuxGSM configs. 

Co-authored-by: H3o66 <chris.h3o66@gmail.com>
2021-01-25 20:25:38 +00:00
Daniel Gibbs
ee515b7786
feat(alerts): add rocket.chat and alerts refactor (#3051)
* update linuxgsm alert logo
* add Rocket.chat alert option
* Refactor of post details by removing pastebin and hastebin
* Improved alert standardisation


Co-authored-by: Alasdair Haig <boaz.sylvannia@live.com>
Co-authored-by: Alasdair Haig <alasdair.coille@gmail.com>
Co-authored-by: AlasdairHaig <AlasdairHaig@users.noreply.github.com>
2020-09-20 14:58:28 +01:00
Christian
a9b3352e0f
feature(alert): add mailgun api eu support (#3035) 2020-09-15 08:54:14 +01:00
Christian
6102c28fd5
fix(config): add pushoveruserkey to all configs (#3028) 2020-09-13 22:40:21 +01:00
Daniel Gibbs
33eb01b387
feat: remove requirement to input IP (#3015)
Removes a long time annoyance for any users who have servers with multiple IP addresses.

Now if the server has more than one IP address LinuxGSM will automatically try query all IP's until it gets a response.

The default IP in settings will now be 0.0.0.0 this also helps resolve issues with source servers and LAN browser #2534

If required it is still possible to manually enter the IP address you want to use. Also, displayip setting is useful if you want your alert to specify an IP address

IP variables for reference
ip the default IP for the server if using 0.0.0.0 LinuxGSM will query all available IP addresses
queryips a list of the ip addresses that will be queried
queryip the ip address that is being queried
displayip the ip/hostname you want to show up in alerts. if unset the internet-facing IP will be used
extip the external internet-facing IP address
2020-09-12 21:53:45 +01:00
Daniel Gibbs
67333ffeb9
feat(console): allow console to state if verbose and/or interactive (#3000) 2020-08-09 20:30:52 +01:00
Daniel Gibbs
167cf43e5b codacy 2020-07-17 23:56:51 +01:00
Daniel Gibbs
a3da62fb1a
feat(stop): add end option to graceful stop (#2963) 2020-07-13 23:04:18 +01:00
Christian
2f9800e13c
feat(newserver): Avorion (#2476)
Co-authored-by: Daniel Gibbs <me@danielgibbs.co.uk>
2020-04-22 22:12:47 +01:00
Daniel Gibbs
25cfd3b8c4
fix: correct and standardise name of goldsrc engine (#2803)
GoldSrc servers were named variants of Gold Source. Using correct engine name GoldSrc
2020-04-03 23:01:16 +01:00
Daniel Gibbs
306faa9e01
feat: standardise config vars and fix session only monitor (#2736)
* fix(monitor): bypass port query if session only mode selected

* removed factorio queryport

* remove queryport from servers that do not use them

* add check_config to details command

* updated eco servercfgdir

* update _default.cfg test

* update _default.cfg test

* update test master config

* reordered servercfg vars

* re-ordered and standardised config file vars

* tidy configs

* shellcheck

* standardised servercfgdir
2020-03-13 06:56:18 +00:00
Daniel Gibbs
260428fe7d
feat: deprecate servercfgfullpath variable (#2724)
* migrating servercfgfullpath

* migrated servercfgpath

* removed servercfgfullpath from _default.cfg as always the same

* removed servercfgfullpathdefault as not needed

* re-ordered sdtd
2020-03-11 09:14:47 +00:00
Frisasky
ce2005ab6a feat(post-details): change default post target from hastebin to termbin (#2645) 2020-01-07 08:59:58 +00:00
Daniel Gibbs
b4290a3c96
feat(linuxgsm): depricate servicename variable (#2594)
servicename has been now completely replaced with selfname
2019-11-25 09:55:31 +00:00
Daniel Gibbs
351cf4035a
feat(monitor): migrate monitor settings to _default.cfg (#2611)
* add mumble query
* re-ordered serverlist.csv
* gamedig refactor
* query raw update
* gamedig: changed --query_port to --port
* add query data to log
* remove UDP query as does not work.
* refactor gamedig and gsquery
* add missing Factorio rcon port
* add fn_monitor_check_queryport
* add TCP query to Factorio
* add mta query support
* MTA IP address must be set. No longer using config
* remove mumble and ts3 from bypassing check_ip
* update netstat command for Project Zomboid
* adde query port to Project Zomboid
* update query mode for samp
* Update Teeworlds query
* add Soldat to TCP query
* update ss3 port info
* add query details to Serious Sam 3
* add Terraria query port
* ts3 now uses tcp query as proper query requires permissions changes
* update ut99 query
* gsquery add gamespy1
* separate out unreal engine functions
* updated ut2k4 query
* update Teeworlds query
* update Factorio query
* change engine if to shortname
2019-11-25 09:50:01 +00:00
Daniel Gibbs
8dd03776d3
feat(stats): add new feature LinuxGSM stat (#2590) 2019-11-15 17:56:07 +00:00
Daniel Gibbs
c99fb69ffa
Add missing comma 2019-11-10 22:54:51 +00:00
Daniel Gibbs
e27143946f
fix(config): standardise design and bug fixes various issues with _default.cfg files (#2582) 2019-11-10 22:45:52 +00:00
Daniel Gibbs
1e59974158 resolved release review comments 2019-10-16 22:40:24 +01:00
Kenny Lindelof
fc13af0b9c feat(alerts): add slack support to alerts (#2529)
* working on slack integration need to test on an actual server now

* forgot to include the correct script

* fixed a couple things with naming

* added slack alert to the core_functions list

* fixed issue with variables on slack alert

* changed message structure to not be hard coded

* trying to resolve jq problem with parsing

* had the gamename where the hostname should be

* fixed error with jq and how the data was formated

* fixed if logic to look for ok on response from slack webhook

* missed a space

* added doc URL to slack in default config

* added slack alert variables to remaining configs
2019-10-06 18:29:35 +01:00
Daniel Gibbs
7c9a4f7d82
feat(stop): stop type can now be set in _default.cfg (#2520) 2019-09-20 23:25:23 +01:00
Christian
20473df46e refactor(backup): unify backupdir on all configs (#2405)
Co-authored-by: Christian Birk <chris.h3o66@gmail.com>
2019-08-27 15:33:46 +01:00
Daniel Gibbs
eb391b13ee
feat(monitor): monitor queries will not begin immediately after start (#2391)
A delay timer has been added to give game servers time to boot before monitor begins query. This is useful for large game servers or that have several mods 

querydelay setting has been added to _default.cfg
2019-06-16 09:25:45 +01:00
Daniel Gibbs
5901f19d07
feat(alerts): add displayip variable (#2310) 2019-06-11 22:35:46 +01:00
Daniel Gibbs
c4ff9c80fa
feat(glibc): migrate glibc info to _default.cfg (#2379) 2019-06-09 00:38:10 +01:00
Daniel Gibbs
fa6cfe4086
feat(ui): add message display setting (#2357)
* setting to change the time in seconds messages are displayed. Default 0.5s
* Travis-CI messages have a 0s delay to speed up testing.
2019-05-12 22:28:27 +01:00
Daniel Gibbs
fc4028296f refactor(docs): change all urls from the old wiki to new docs (#2122)
refactor(docs): change all urls from the old wiki to new docs (#2122)
2018-12-16 00:05:29 +00:00
Daniel Gibbs
f32ef345ef
Added missing Colours (#1987)
* Added missing colours

* Added option to turn ansi colours off
2018-08-13 21:58:39 +01:00
Kirill Shamilin
88f2ce544b
Update _default.cfg 2018-05-18 00:13:53 +03:00
Daniel Gibbs
6f692f5ca5 added post details log 2017-09-03 11:15:35 +01:00
Daniel Gibbs
de8032d671 Added flags for more info as this setting is optional 2017-09-03 10:40:21 +01:00
Daniel Gibbs
1b7f2f9626 Alerts will postdetails to allow more info in alert 2017-09-01 15:37:52 +01:00
Daniel Gibbs
cb556fbecb Added mailgun settings 2017-09-01 15:18:22 +01:00
Daniel Gibbs
53d0e1f272 IFTTT added ability to change event name 2017-08-22 09:32:49 +01:00
Daniel Gibbs
3ed2cf12c3 Added discord and IFTTT 2017-08-22 09:28:55 +01:00
Marvin Lehmann
5a3e3d5b50 Fixed telegram comment typo 2017-08-21 18:36:07 +02:00
Daniel Gibbs
b41fa63e13 Added Pushover 2017-08-21 15:51:02 +01:00
Daniel Gibbs
80fc9da580 Improvements to telegram alerts 2017-08-20 14:11:32 +01:00
Bennet Becker
9ec6e013df Adding Telegram Bot Alerts 2017-07-15 17:33:44 +02:00
Daniel Gibbs
4599551e27 Changed to serverfies 2017-05-27 11:11:55 +01:00
Daniel Gibbs
21eed95f9f Uploading all configs
Not fully tested yet
2017-05-26 22:04:48 +01:00