title: Zabbix Discovery Rule by custom script: need any advices
body: <p>I'm trying to make discovery rule to add file size monitor. But when I add my Template to Host, zabbix says me:</p>
  
  <blockquote>
    <p>Value should be a JSON object</p>
  </blockquote>
  
  <ul>
  <li>Zabbix Agent (daemon) v2.2.10 (revision 54806) (10 August 2015)</li>
  <li>Zabbix server v2.2.9 (revision 52686) (12 March 2015)</li>
  </ul>
  
  <p>I've written the python-script:</p>
  
  <pre><code>import os
  import sys
  import json
  
  logdir = sys.argv[1]
  
  data = []
  
  for (logdir, _, files) in os.walk(logdir):
          for f in files:
                  if f.endswith(".log"):
                          path = os.path.join(logdir, f)
                          data.append({'#LOGFILEPATH':path})
                          jsondata = json.dumps(data)
  
  print jsondata
  </code></pre>
  
  <p>It works fine and gets follows:</p>
  
  <pre><code>[{"#LOGFILEPATH": "/opt/logs/projects/cms/cms.log"}, {"#LOGFILEPATH": "/opt/logs/projects/books/nginx.log"}]
  </code></pre>
  
  <p>I've checked it by jsonlint.com - valid JSON.</p>
  
  <p>UserParameter in conf.d:</p>
  
  <pre><code>UserParameter = discovery.logfile.path, python /opt/scripts/zabbix/find.logfile.path.and.size.py /opt/logs/
  </code></pre>
  
  <p>There are attachments show my discovery configuration:</p>
  
  <p><img src="https://i.stack.imgur.com/840Ju.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/2tTVS.png" alt="enter image description here"></p>
  
  <p>User <em>zabbix</em> has permission to directory with script and logs.</p>