Ad Widget

Collapse

Zabbix LLD not running after assigning template to Host (no Items/Triggers created)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whanklee
    Junior Member
    • Dec 2019
    • 19

    #1

    Zabbix LLD not running after assigning template to Host (no Items/Triggers created)

    Hello,


    I’d like to ask for your help to understand what might be wrong with the template and the Zabbix server configuration below. When I assign the template to a Host, nothing happens — it doesn’t run, and no new Items or Triggers appear. I have to restart the server, sometimes multiple times, before the LLD finally runs. There are no errors in the logs, but it still doesn’t execute.

    zabbix_server.conf:

    LogFile=/var/log/zabbix/zabbix_server.log
    LogFileSize=0
    PidFile=/run/zabbix/zabbix_server.pid
    SocketDir=/run/zabbix
    DBName=******
    DBUser=******
    DBPassword=*******
    StartHTTPPollers=10
    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    CacheSize=256M
    CacheUpdateFrequency=60
    HistoryCacheSize=128M
    HistoryIndexCacheSize=32M
    TrendCacheSize=32M
    ValueCacheSize=128M
    Timeout=4
    FpingLocation=/usr/bin/fping
    Fping6Location=/usr/bin/fping6
    LogSlowQueries=3000
    StartLLDProcessors=20
    StatsAllowedIP=127.0.0.1
    EnableGlobalScripts=1
    Code:
    zabbix_export:
    version: '7.4'
    template_groups:
    - uuid: 5f30ef4d286b437d81f4419cb49ac1dd
    name: WORK
    - uuid: 7df96b18c230490a9a0a9e2307226338
    name: Templates
    templates:
    - uuid: 4a6adadd8f8346c0ac3f88cadf290429
    template: 'WP-Cron Monitor with Job Discovery'
    name: 'WP-Cron Monitor with Job Discovery'
    groups:
    - name: WORK
    - name: Templates
    discovery_rules:
    - uuid: f7e6b3a2f69e4f689f12b4a07ced7b26
    name: 'WP-Cron sites discovery'
    type: SCRIPT
    key: wp.cron.discovery
    delay: 1h
    params: 'return ''{$WPCRON_SITES_JSON}'';'
    item_prototypes:
    - uuid: ce63ee9f350a47d79a975366e67fca09
    name: 'WP-Cron JSON on {#SITE}'
    type: HTTP_AGENT
    key: 'wp.cron.json[{#SITE}]'
    value_type: TEXT
    url: 'https://{#SITE}/wp-json/monitor/cron'
    headers:
    - name: X-API-Key
    value: '{$X_API_KEY:"{#SITE}"}'
    tags:
    - tag: WORK
    value: WP-Cron
    trigger_prototypes:
    - uuid: ae25c55d47a448b3a17cda01766b020d
    expression: 'nodata(/WP-Cron Monitor with Job Discovery/wp.cron.json[{#SITE}],10m)=1'
    name: 'WP-Cron endpoint no data (10m) on {#SITE}'
    priority: HIGH
    tags:
    - tag: WORK
    value: WP-Cron
    - uuid: 2fae8d5469884331aff2537aaeac66a4
    name: 'WP-Cron now timestamp on {#SITE}'
    type: DEPENDENT
    key: 'wp.cron.now_ts[{#SITE}]'
    units: unixtime
    preprocessing:
    - type: JSONPATH
    parameters:
    - $.now
    master_item:
    key: 'wp.cron.json[{#SITE}]'
    tags:
    - tag: WORK
    value: WP-Cron
    - uuid: b1f73ac3ad1b41d286a7d9ac1824f2ac
    name: 'WP-Cron status on {#SITE}'
    type: DEPENDENT
    key: 'wp.cron.status[{#SITE}]'
    value_type: TEXT
    preprocessing:
    - type: JSONPATH
    parameters:
    - $.status
    master_item:
    key: 'wp.cron.json[{#SITE}]'
    tags:
    - tag: WORK
    value: WP-Cron
    trigger_prototypes:
    - uuid: 35c77e5f7cd1477496bf005fd2085741
    expression: 'last(/WP-Cron Monitor with Job Discovery/wp.cron.status[{#SITE}])<>"ok"'
    name: 'WP-Cron status is not OK on {#SITE}'
    priority: WARNING
    tags:
    - tag: WORK
    value: WP-Cron
    - uuid: d638275756974003ba5977e54a4c6b13
    name: 'WP-Cron Job discovery [{#SITE}]'
    type: DEPENDENT
    key: 'wp.cron.job.discovery[{#SITE}]'
    item_prototypes:
    - uuid: aab2a52895f541a0aebcd626c8a67ac1
    name: 'WP-Cron Job Lag: {#JOB_HOOK} on {#SITE}'
    type: CALCULATED
    key: 'wp.cron.job.lag[{#SITE},{#JOB_HOOK}]'
    value_type: FLOAT
    units: s
    params: '{#JOB_NEXT_RUN} - last(//wp.cron.now_ts[{#SITE}])'
    tags:
    - tag: Job
    value: '{#JOB_HOOK}'
    - tag: WORK
    value: WP-Cron
    trigger_prototypes:
    - uuid: 0a3841c004e345bba59d46e5262edef1
    expression: 'last(/WP-Cron Monitor with Job Discovery/wp.cron.job.lag[{#SITE},{#JOB_HOOK}]) < -{$WPCRON_OVERDUE_THRESHOLD}'
    name: 'WP-Cron job ''{#JOB_HOOK}'' is overdue on {#SITE}'
    priority: AVERAGE
    tags:
    - tag: Job
    value: '{#JOB_HOOK}'
    - tag: WORK
    value: WP-Cron
    parent_discovery_rule:
    key: wp.cron.discovery
    master_item:
    key: 'wp.cron.json[{#SITE}]'
    lld_macro_paths:
    - lld_macro: '{#JOB_HOOK}'
    path: $.hook
    - lld_macro: '{#JOB_INTERVAL}'
    path: $.interval
    - lld_macro: '{#JOB_NEXT_RUN}'
    path: $.next_run
    - lld_macro: '{#JOB_SCHEDULE}'
    path: $.schedule
    preprocessing:
    - type: JSONPATH
    parameters:
    - $.jobs
    - type: DISCARD_UNCHANGED_HEARTBEAT
    parameters:
    - 1h
    tags:
    - tag: WORK
    value: WP-Cron
    macros:
    - macro: '{$WPCRON_LAG_THRESHOLD}'
    value: '900'
    description: 'DEPRECATED (use WPCRON_OVERDUE_THRESHOLD)'
    - macro: '{$WPCRON_OVERDUE_THRESHOLD}'
    value: '300'
    description: 'In seconds: trigger alert if job is overdue by this value (default: 5 minutes)'
    - macro: '{$WPCRON_SITES_JSON}'
    value: '{"data":[{"{#SITE}":"website1.hu"},{"{#SITE}":"website2.hu"}]}'
    description: 'LLD JSON list of domains to be monitored'
    - macro: '{$X_API_KEY:"website1.hu"}'
    value: a86af02b-*******-d6a****f35b
    - macro: '{$X_API_KEY:"website2.hu"}'
    value: 4b3f040d-*******-88a****d48
    Also, when I call the WordPress API, this is the response I receive:

    Code:
    {
        "status": "ok",
        "now": 1763716555,
        "jobs": [
            {
                "hook": "action_scheduler_run_queue_rucss",
                "next_run": 1763716530,
                "schedule": "every_minute",
                "interval": 60
            },
            {
                "hook": "wpcode_usage_tracking_cron",
                "next_run": 1764220609,
                "schedule": "weekly",
                "interval": 604800
            },
            {
                "hook": "newsletter_clean",
                "next_run": 1764264915,
                "schedule": "weekly",
                "interval": 604800
            }
        ]
    }​
    Last edited by whanklee; 21-11-2025, 19:17.
  • Viktors Fomics
    Member
    • Oct 2025
    • 42

    #2
    Hello

    I can see that the discovery rule has a delay of 1h, it might cause issues:

    name: 'WP-Cron sites discovery'
    type: SCRIPT
    key: wp.cron.discovery
    delay: 1h
    I'd suggest setting up a shorter delay there for testing purposes: for example setting it to 1m and checking if the behaviour improves.



    Comment

    • whanklee
      Junior Member
      • Dec 2019
      • 19

      #3

      Yes, I’m aware of that, and I already tried setting the delay to 1m, but it didn’t solve the problem. Nothing happened. The only thing that makes it run is restarting the Zabbix server and using zabbix_server -R config_cache_reload.

      It feels like there is some kind of configuration issue on the server, but I haven’t been able to figure out what it could be.
      Last edited by whanklee; 21-11-2025, 19:23.

      Comment

      • cyber
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Dec 2006
        • 4807

        #4
        I stumbled on this lately, did not work out, what was the issue, but it started to work after I just forced "execute now"... After that it stayed working a it should

        Comment

        • whanklee
          Junior Member
          • Dec 2019
          • 19

          #5
          Yes, it also works for me if I trigger it manually, but I still can’t figure out why it needs to be executed manually in the first place.

          Comment

          Working...