-
Incident report
-
Resolution: Fixed
-
Minor
-
1.9.9 (beta)
I am trying to create my own low-level discovery rule using JSON format which is described on:
http://www.zabbix.com/documentation/2.0/manual/discovery/low_level_discovery#discovery_item_json_format
1. zabbix_agentd host (h157)
a) file /usr/local/home/a (exact from documentation content):
#!/usr/bin/perl
$first = 1;
print "{\n";
print "\t\"vfs.fs.discovery_perl\":[\n\n";
for (`cat /proc/mounts`)
{
($fsname, $fstype) = m/\S+ (\S+) (\S+)/;
$fsname =~ s!/!
/!g;
print "\t,\n" if not $first;
$first = 0;
print "\t{\n";
print "\t\t\"
print "\t\t\"{#FSTYPE}\":\"$fstype\"\n";
print "\t}\n";
}
print "\n\t]\n";
print "}\n";
b) zabbix_agentd.conf:
UserParameter=a,/usr/local/home/a
2. zabbix_server side:
a) testing item 'a':
# zabbix_get -s h157 -k a
{
"vfs.fs.discovery_perl":[
{
"{#FSNAME}
":"\/",
"
}
,
{
"{#FSNAME}":"\/",
"{#FSTYPE}
":"ext4"
}
,
{
"
"{#FSTYPE}":"devtmpfs"
}
,
{
"{#FSNAME}
":"\/proc",
"
}
,
{
"{#FSNAME}":"\/sys",
"{#FSTYPE}
":"sysfs"
}
,
{
"
"{#FSTYPE}":"tmpfs"
}
,
{
"{#FSNAME}
":"\/dev\/pts",
"
}
,
{
"{#FSNAME}":"\/dev\/shm",
"{#FSTYPE}
":"tmpfs"
}
,
{
"
"{#FSTYPE}":"ext4"
}
,
{
"{#FSNAME}
":"\/dist\/dev",
"
}
,
{
"{#FSNAME}":"\/dist\/usr\/run",
"{#FSTYPE}
":"ext4"
}
,
{
"
"{#FSTYPE}":"cgroup"
}
,
{
"{#FSNAME}
":"\/fs\/m-b10",
"
}
,
{
"{#FSNAME}":"\/fs\/data2",
"{#FSTYPE}
":"ext4"
}
,
{
"
":"\/fs\/data",
"
":"ext4"
}
]
}
Data returned from item 'a' seems to be correct JSON format.
However in position with discovery rule 'a' there is an error:
"wrong data in JSON object"