Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

items haven't been created. #9

Open
siuwwong5 opened this issue Apr 21, 2020 · 3 comments
Open

items haven't been created. #9

siuwwong5 opened this issue Apr 21, 2020 · 3 comments

Comments

@siuwwong5
Copy link

after i start the provisioner, i found these logs. and cannot found item created. please help.

time="2020-04-21T07:25:10Z" level=info msg="loading configuration at '/etc/provisioner/config.yaml'"
time="2020-04-21T07:25:10Z" level=info msg="configuration loaded"
time="2020-04-21T07:25:10Z" level=info msg="GetHostGroupsByState = State: Equal, Name: prometheus"
time="2020-04-21T07:25:10Z" level=info msg="GetHostByState = State: Equal, Name: prometheus"
time="2020-04-21T07:25:10Z" level=info msg="Updating host: prometheus"

[root@coshk3cvdv00294 zabbix_provisioner]# cat ../alertmanager/data/alert.rules
groups:

  • name: testing
    rules:
    • alert: ContainerKilled
      expr: sum(container_memory_rss{name=~".+"}) by (image, instance) < 1
      for: 1s
      labels:
      severity: warning
      annotations:
      zabbix: "prometheus"
      summary: "Container killed (instance {{ $labels.image }})"
      description: "A container has disappeared\n VALUE = {{ $value }}\n LABELS: {{ $labels.image }}"

    • alert: InfluxdbDown
      expr: absent(container_last_seen{name='influxdb'})
      for: 3m
      labels:
      severity: page
      annotations:
      zabbix: "prometheus"
      summary: "InfluxdbDown"
      description: "InfluxdbDown."

    • alert: GrafanaDown
      expr: absent(container_last_seen{name='grafana'})
      for: 3m
      labels:
      severity: page
      annotations:
      zabbix: "prometheus"
      summary: "GrafanaDown"
      description: "GrafanaDown."

    • alert: CadvisorDown
      expr: up{job="cadvisor"} == 0
      for: 10s
      labels:
      severity: page
      annotations:
      zabbix: "prometheus"
      summary: "Cadvisor Down (instance {{ $labels.instance }})"
      description: "A cadvisor has down\n VALUE = {{ $value }}\n LABELS: {{ $labels }}"

@siuwwong5
Copy link
Author

siuwwong5 commented Apr 21, 2020

[root@coshk3cvdv00294 zabbix_provisioner]# cat config.yaml
# URL to the Status/Rules page
rulesUrl: http://coshk3cvdv00294:9090/rules

# Polling interval in seconds
rulesPollingInterval: 3600

# Full URL to your Zabbix API
zabbixApiUrl: http://coszbxdev.iris.cl.sh.cos/api_jsonrpc.php

# If your Zabbix server use internal certificates, you can provide a CA bundle for your company (or leave it blank)
zabbixApiCAFile:

# This can also be set via the environment variable ZABBIX_API_USER
zabbixApiUser:

# This can also be set via the environment variable ZABBIX_API_PASSWORD
zabbixApiPassword:

# Zabbix items key prefix, keys will be zabbixKeyPrefix.alertname
zabbixKeyPrefix: prometheus

# List of host configuration
zabbixHosts:
# Name of the host in zabbix

  • name: prometheus
    # Key/Value pairs that must be present on a prometheus rule in order for it to be selected for that host
    selector:
    zabbix: prometheus
    # List of host groups the host will belong to
    hostGroups:
    • prometheus
      # tag and deploymentStatus are inventory fields currently supported for an host
      tag: MYTAG
      deploymentStatus: 0
      # itemDefault* below, defines item values when not specified in a rule
      itemDefaultApplication: prometheus
      # For history and trends in zabbix 2.x you have to put those in days like 7 or 90
      itemDefaultHistory: 5d
      itemDefaultTrends: 190d
      itemDefaultTrapperHosts: 0.0.0.0/0 # Hosts permitted to send data (your webhook external CIDR, default is from everywhere)

@Gigabeats
Copy link

I'm getting the same problem:
the pod works fine with any errors, but no rules or items are loaded to zabbix.

cat /prometheus/alert.rules

  • name: general.rules
    rules:
    • alert: TargetDown
      annotations:
      message: '{{ printf "%.4g" $value }}% of the {{ $labels.job }}/{{ $labels.service
      }} targets in {{ $labels.namespace }} namespace are down.'
      expr: 100 * (count(up == 0) BY (job, namespace, service) / count(up) BY (job,
      namespace, service)) < 10
      for: 10m
      labels:
      severity: warning
    • alert: Watchdog
      annotations:
      message: |
      This is an alert meant to ensure that the entire alerting pipeline is functional.
      This alert is always firing, therefore it should always be firing in Alertmanager
      and always fire against a receiver. There are integrations with various notification
      mechanisms that send a notification when this alert is not firing. For example the
      "DeadMansSnitch" integration in PagerDuty.
      zabbix: PrometheusDev
      zabbix_description: This is supposed to go empty
      zabbix_trigger_name: Test
      expr: vector(1)
      labels:
      severity: none

The provisioner logs:
time="2020-06-30T10:54:52Z" level=info msg="loading configuration at '/etc/provisioner/config.yaml'"
time="2020-06-30T10:54:52Z" level=info msg="configuration loaded"
time="2020-06-30T10:54:53Z" level=info msg="GetHostGroupsByState = State: Equal, Name: kubernetes"
time="2020-06-30T10:54:53Z" level=info msg="GetHostGroupsByState = State: Equal, Name: prometheus"
time="2020-06-30T10:54:53Z" level=info msg="GetHostByState = State: Equal, Name: PrometheusDev"
time="2020-06-30T10:54:53Z" level=info msg="Updating host: PrometheusDev"

The used config file:
apiVersion: v1
kind: ConfigMap
metadata:
name: alertmanager-zabbix-provisioner-config
namespace: monitoring
data:
config.yaml: |+
rulesUrl: http://dev-prometheus.com/rules
rulesPollingTime: 3600
zabbixApiUrl: http://dev-zabbix.com/zabbix/api_jsonrpc.php
zabbixKeyPrefix: prometheus
zabbixHosts:
- name: PrometheusDev
selector:
zabbix: PrometheusDev
hostGroups:
- kubernetes
- prometheus
tag: MYTAG
deploymentStatus: 0
itemDefaultApplication: prometheus
itemDefaultHistory: 7d
itemDefaultTrends: 90d
itemDefaultTrapperHosts: 0.0.0.0/0

Need your help Gael, pls.

@Gigabeats
Copy link

The config file is idented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants