Skip to content

Commit e7ea2b4

Browse files
committed
custom macro regex for group-id adapted
1 parent b322246 commit e7ea2b4

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ Telegram has long been one of my real-time communication media. It is obvious to
1616
- [ACTIVATE CHANGES](#activate-changes)
1717
- [PRIVACY ANONYMIZATION / MASQUERADING](#privacy-anonymization--masquerading)
1818
- [PAGER ADDRESS CHAT-ID INSTEAD OF TELEGRAM GROUP-ID](#pager-address-chat-id-instead-of-telegram-group-id)
19-
- [Custom user attribute](#custom-user-attribute)
19+
- [CUSTOM USER ATTRIBUTE](#custom-user-attribute)
20+
- [CUSTOM MACRO OPTIONAL](#custom-macro-optional)
2021
- [TROUBLESHOOTING](#troubleshooting)
2122
- [CONTRIBUTIONS](#contributions)
2223
- [LICENSE](#license)
@@ -67,6 +68,7 @@ chmod +x check_mk_telegram-notify.sh
6768
```
6869

6970
## CHECK_MK CONFIGURATION
71+
7072
### CHECK_MK VERSION 2.0.0 AND ABOVE
7173
Now you can create your own alarm rules in Check_MK.
7274

@@ -152,26 +154,32 @@ else
152154
fi
153155
```
154156

155-
### Custom user attribute
157+
### CUSTOM USER ATTRIBUTE
156158
You can add a custom user attribute and use it in your script.
157-
Go TO `Setup>UsersCustom>user attributes` and create a custom attribute named `TELEGRAMCHAT`, do not change the name, you can change the Title and Help Text.
158-
<img src="images/create_custom_user_attribute.PNG" alt="Custom User attribute creation" width="100%"/>
159+
Go TO `Setup > UsersCustom > user attributes` and create a custom attribute named `TELEGRAMCHAT`, do not change the name, you can change the Title and Help Text.
160+
<img src="images/create_custom_user_attribute.png" alt="Custom User attribute creation" width="100%"/>
159161

160-
#### Optional custom macro
161-
Go To `Setup>Events>Notification configuration>` and edit your notifcation. Add a custom macro.
162+
### CUSTOM MACRO (OPTIONAL)
163+
Go To `Setup > Events > Notification configuration>` and edit your notifcation. Add a custom macro.
162164

163-
Regex : ```\d{5,}```
165+
This pattern will accept numbers with or without an optional minus sign and requires a minimum of 5 digits.:
166+
Regex : ```^-?\d{5,}$```
164167

165-
The Macro checks for an at least 5 digit long number, if your Chatid differs, you can adjust that, this also ensures that only those with a chatid set up will get notified. (could work also as a whitelist)
168+
- Breakdown:
169+
```
170+
^: Start of the string.
171+
-?: An optional minus sign.
172+
\d{5,}: Five or more consecutive digits.
173+
$: End of the string.
174+
```
166175

167-
<img src="images/notification_custom_macro.PNG" alt="Custom macro for notification" width="100%"/>
176+
The Macro checks for an at least 5 digit long number, if your Chatid differs, you can adjust that, this also ensures that only those with a chatid set up will get notified. (could work also as a whitelist)
168177

178+
<img src="images/notification_custom_macro.png" alt="Custom macro for notification" width="100%"/>
169179

170180
Edit your user and enter your Group/Chat-ID
171181

172-
173-
<img src="images/user_add_chat_id.PNG" alt="Custom macro for notification" width="100%"/>
174-
182+
<img src="images/user_add_chat_id.png" alt="Custom macro for notification" width="100%"/>
175183

176184
## TROUBLESHOOTING
177185
For more details and troubleshooting with parameters please check:
@@ -182,6 +190,7 @@ For more details and troubleshooting with parameters please check:
182190
## CONTRIBUTIONS
183191
* Thank you for the excellent code optimization contributions and additional information [ThomasKaiser](https://github.com/ThomasKaiser).
184192
* Best regards to [Jonathan Barratt](https://github.com/reduxionist) in Bangkok and many thanks for adding emojies to the module.
193+
* Many thanks to [progamernoob](https://github.com/progamernoob) for the contributions and enhancements to custom user attributes and macros.
185194

186195
## LICENSE
187196
checkmk-telegram-notify and all individual scripts are under the BSD 3-Clause license unless explicitly noted otherwise. Please refer to the LICENSE
2.03 KB
Loading

0 commit comments

Comments
 (0)