Comments (3)
Which version are you using?
Also, in the middle code snippet, you are setting notification.sms.users
within vars.curl_checks["pr01_check"]
, is that intended?
I think it would help if you'd also share more of the object definitions so that it's clear what's within an object/template/apply rule and what is imported where.
Commenting out that line in service template fixes my problems.
Having a look at the output of the following command for the affected service with and without the line commented out could also give some clues:
icinga2 object list -t Service -n 'affected-host-name!affected-service-name'
from icinga2.
I am running icinga2 2.14 , on Debian. Packages are from icinga's deb repository.
this is what is produced when i had that line enabled:
{
"curl_credentials": "configurator:sekrit",
"curl_critical": 7200,
"curl_hostname": "server..com",
"curl_port": 8080,
"curl_request": "GET",
"curl_url": "management/queue/monitoring/secondsSinceTheOldestMessageInQueue/ACTIVE",
"curl_warning": 3600,
"display_name": "Oldest message in w ACTIVE",
"jira_notification_config": {
"jira_project": "MU",
"jira_template": "cmb_utrzymanie",
"times": {
"begin": 600
},
"users": [
"jira_cmb"
]
},
"notification": {
"jira": {
"times": {
"begin": 3600
}
},
"mail": {
"extra_groups": [
"utrzymanie-cmb"
],
"interval": 86400,
"period": "workhours"
}
}
}
I only had the older dump that i formatted via jq.
And the vars section when it is disabled
* vars
% = modified in '/etc/icinga2/zones.d/global/service/check_curl_value.conf', lines 4:2-4:15
* curl_credentials = "configurator:sekrit"
* curl_critical = 7200
* curl_hostname = "server..com"
* curl_port = 8080
* curl_request = "GET"
* curl_url = "management/queue/monitoring/secondsSinceTheOldestMessageInQueue/ACTIVE"
* curl_warning = 3600
* display_name = "Oldest message in ACTIVE"
* notification
* sms
* users = [ "cmb-sms", "dyzur_20_7" ]
* users = [ "grczyz" ]
Also, in the middle code snippet, you are setting notification.sms.users within vars.curl_checks["pr01_check"], is that intended?
I think i was trying to narrow down what was going on, that was superfluous.
The relevant config is here
vars.curl_checks["queue-oldest-msg-ACTIVE"] = {
display_name = "Oldest message in ACTIVE"
curl_credentials = "configurator:sekrit"
curl_hostname = "server.com"
curl_url = "management/queue/monitoring/secondsSinceTheOldestMessageInQueue/ACTIVE"
curl_port = 8080
curl_request = "GET"
curl_critical = 7200
curl_warning = 3600
notification.users += [ "grczyz" ]
notification.sms.users = [ "cmb-sms" , "dyzur_20_7" ]
}
This is constructed via generic for loop
apply Service "curl_check" for (check_name => config in host.vars.curl_checks) {
check_command = "check-curl-value"
vars += config
import "fix-display-name" // this maps vars.display_name to display_name
import "generic-service"
assign where host.vars.curl_checks
}
And the imported template:
template Service "generic-service" {
max_check_attempts = 5
check_interval = 5m
retry_interval = 90s
check_period = "24x7"
// this causes problems, destroying existing service.vars.notification.*
//if (host.vars.all_services) {
// vars += host.vars.all_services
//}
// import global host defaults, i added this as a workaround. previously i searched through vars imported in above section
if (host.vars.all_services.notification.period) {
check_period = host.vars.all_services.notification.period
}
if (host.vars.all_services.notification.interval) {
check_interval = host.vars.all_services.notification.interval
}
if (host.vars.all_services.notification.check_attempts) {
max_check_attemps = host.vars.all_services.notification.check_attempts
}
if (service.vars.check_period) {
check_period = service.vars.check_period
}
if (service.vars.check_interval) {
check_interval = service.vars.check_interval
}
if (service.vars.max_check_attempts) {
max_check_attempts = service.vars.max_check_attempts
}
}
from icinga2.
vars += host.vars.all_services
does something quite different.
To me it looks like you expect vars.all_services.notification.mail.extra_groups += [ "support-PR01" ]
to be the same as
vars += {
all_services = {
notification = {
mail = {
extra_groups = [ "support-PR01" ]
}
}
}
}
But the latter is more like this:
vars.all_services = {
notification = {
mail = {
extra_groups = [ "support-PR01" ]
}
}
}
That is, +=
does not attempt to deep-merge any data structures. So with base
and extra
being dicts, base += extra
takes all keys and values contained directly in extra
and sets them in base
(where set means replacing the value at a key if that was set before).
from icinga2.
Related Issues (20)
- [Feature Request] Notifications for DowntimeCreated
- [Feature Request] built-in icinga check - add check for enabled / allowed features HOT 1
- Automatically renew the CA HOT 1
- Wrong Notifications in Icinga due to discrepancies between icinga2 and icingaweb HOT 2
- Notifications sent after a huge delay
- icinga2 crashes silently - "Assertion px!=0 failed" in error.log
- Add support for advanced performance data format (eg: openmetrics)
- Prometheus remote writer
- Child service becomes reachable, even when only one parent changes to OK HOT 2
- Automatic key rollover on TLS leaf cert renewal
- Automatic periodic CA (key) rollover HOT 1
- Monitoring backend 'icinga2' is not running HOT 8
- check_haproxy_status - No such file or directory HOT 1
- Update ITL for check_snmp
- Config Sync API: Filter Packages in API
- Icinga2 api deadlock HOT 5
- Update ITL commands - several parameter for checks missing
- TLS: custom DH parameters HOT 4
- cluster-zone check reports mysterious zone lag values (at least for command_endpoint agents) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icinga2.