Ad Widget

Collapse

Domain Blacklist template

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • k-hole
    Junior Member
    • Aug 2022
    • 10

    #1

    Domain Blacklist template

    Zabbix template and script for monitoring the blacklist status of SMTP domains.
    Zabbix template for monitoring the blacklist status of SMTP domains - a-stoyanov/zabbix-domain-blacklist
  • ckruijntjens
    Junior Member
    • Nov 2025
    • 7

    #2
    Hi There,
    I am using the script but zabbix cant execute it. The script belongs to zabbix. root user can run the script ok. zabbix user returns

    HTTP status: 200, response size: 4502 bytes, error: MXToolbox response lacks expected JSON structure (size
    : 4502 bytes)"

    Any idea what the problem could be?

    Comment

    • k-hole
      Junior Member
      • Aug 2022
      • 10

      #3
      Originally posted by ckruijntjens
      Hi There,
      I am using the script but zabbix cant execute it. The script belongs to zabbix. root user can run the script ok. zabbix user returns

      HTTP status: 200, response size: 4502 bytes, error: MXToolbox response lacks expected JSON structure (size
      : 4502 bytes)"

      Any idea what the problem could be?
      Hello mate,

      The error message means the returned api response was not in JSON format.
      I've also seen this happen before when MXToolbox API is down e.g. for maintenance or an outage.
      It will recover as soon as the API service is back.

      Comment

      • ckruijntjens
        Junior Member
        • Nov 2025
        • 7

        #4
        Originally posted by k-hole

        Hello mate,

        The error message means the returned api response was not in JSON format.
        I've also seen this happen before when MXToolbox API is down e.g. for maintenance or an outage.
        It will recover as soon as the API service is back.
        Hi Mate,

        Thanks for your response. This is no problem with MXtoolbox because when i run the script in the terminal it runs ok..........

        Comment

        • ckruijntjens
          Junior Member
          • Nov 2025
          • 7

          #5
          It just never gives me correct output when the external script is run true zabbix. When i execute it in the terminal it tells me all is ok. The zabbix user has all the rights to execute the script. Any Ideay?

          Comment

          • ckruijntjens
            Junior Member
            • Nov 2025
            • 7

            #6
            Script is not working for me on zabbix 7.4

            Comment

            • k-hole
              Junior Member
              • Aug 2022
              • 10

              #7
              Hello, your case does sound like it could be caused due to lack of permissions.
              The script uses jq to handle the json response format. It's possible your zabbix service account may not have permissions to execute jq or your zabbix-server execution env is selinux restricted.

              Check the ownership/permissions of the script. Try changing ownership to user=root:group=zabbix.gid and relaxing the permissions on the script
              1. Get the group membership of your zabbix account. Check gid with # id zabbix
              2. # chown root:zabbix /usr/lib/zabbix/externalscripts/check_blacklist.sh
              3. # chmod 0775 /usr/lib/zabbix/externalscripts/check_blacklist.sh​
              4. Switch to zabbix user and verify you can run jq

              If you are using selinux in enforcing mode you should verify the script file context is set to object_r:zabbix_script_exec_t
              to check: # ls -laZ /usr/lib/zabbix/externalscripts/check_blacklist.sh

              Comment


              • ckruijntjens
                ckruijntjens commented
                Editing a comment
                Hi,

                Thanks for your reply. I checked it all. still wont work. The zabbix user can run jq. I dont use selinux.

                the script permissions:
                -rwxrwxr-x 1 root zabbix 16947 Dec 11 18:18 check_blacklist.sh


                Ouput of the gui command is:

                {"state":"UNKNOWN","blacklist_count":"0","blacklis t_names":"none","message":"MXTOOLBOX check for domain, HTTP status: 200, response size: 4507 bytes, error: MXToolbox response lacks expected JSON structure (size: 4507 bytes)"}

                When i run it as zabbix user it runs ok:

                zabbix@zabbix:/usr/lib/zabbix/externalscripts$ ./check_blacklist.sh -d domain.nl -m api-key
                {"state":"OK","blacklist_count":"0","blacklist_nam es":"none","message":"MXTOOLBOX check for domain.nl, HTTP status: 200, response size: 4508 bytes"}

                Any more ideas?
                Last edited by ckruijntjens; 19-12-2025, 14:44.
            • ckruijntjens
              Junior Member
              • Nov 2025
              • 7

              #8
              i found the error. In the script the shebang was nont there. i added #!/bin/bash and now it runs ok in the gui.

              Comment

              Working...