-1

How can I convert the following script output to json. i'm trying to use it with Zabbix and it advises that the output must be in json.

/usr/bin/find /home/user/*/current/config -name "sidekiq.yml"|awk -F"/" '{ print " { \"{#DIRNAME}\":\""$4"\"}'

Thanks

user2099762
  • 173
  • 2
  • 12
  • How are you trying to use it? What's the functional goal? If you are trying to use it in LLD, you will have an additional problem when no files are found. And even before that, you will have to follow the Zabbix LLD format. – Richlv Jul 05 '17 at 18:26
  • Server hosts multiple sites, some that use sidekiq. Rather than have to manually input a process for each app, I thought I'd use lld to discover which apps use sidekiq, and then use item prototype to detect if the relevant process is running, as the process is named the same as the folder – user2099762 Jul 05 '17 at 18:50
  • That approach seems reasonable. Please see https://www.zabbix.com/documentation/3.0/manual/discovery/low_level_discovery#creating_custom_lld_rules for an example on the LLD Zabbix expects. Writing the whole script is probably a bit out of scope for an answer, but see the discovery examples in https://www.zabbix.org/websvn/wsvn/zabbix.com/trunk/conf/zabbix_agentd/userparameter_examples.conf for an inspiration. – Richlv Jul 05 '17 at 23:05
  • I do when i've had time to test them...... – user2099762 Jul 06 '17 at 09:20

1 Answers1

0

Problem was solved using the zabbix lld documentation. Thanks to everyone that helped....

user2099762
  • 173
  • 2
  • 12