Hi,
I have been trying to get zabbix 2.0.6 to monitor windows mountpoints, i have written some code that queries wmi and produces the names of the Mountpoints, i then munge that into a JSON format and zabbix discovers the Mountpoints perfectly.
using the normal vfs.fs.size keys etc its all fine and working as expected (although i had to escape the backslashes and remove the trailing backslash).
I now want to setup an item prototype for perfmon counters, the perfmon counters themselves work from zabbix_get but when i replace the mountpoint with {#MPNAME} it appears not to be working, i have tried quotes and escapes everywhere but its just not playing ball, Has anyone managed to do this?
for anyone it might be of use to:-
I do have activestate perl so compile a script for windows and add the following to zabbix_agentd.conf
UserParameter=sj.discovery,c:\zabbix2\sj-discovery.exe
my perl script is as follows:-
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('dbi:WMI:');
my $sth = $dbh->prepare(<<WQL);
select name from win32_volume where drivetype=3 AND driveletter=NULL
WQL
$sth->execute();
print "{\"data\":[";
my $i = 1;
while (my @row = $sth->fetchrow) {
if ($i != 1) {print ","};
$row[0] =~ s/\\$//;
$row[0] =~ s/\\/\\\\/g;
print "{\"{\#MPNAME}\":\"$row[0]\"}";
$i++;
};
print "]}";
the JSON that is produced is :-
{"data":[{"{#MPNAME}":"S:\\oracle\\oradata\\DB1\\archive1"} ,{"{#MPNAME}":"S:\\oracle\\oradata\\DB1\\redo2"},{ "{#MPNAME}":"S:\\oracle\\oradata\\DB1\\index1"},{" {#MPNAME}":"S:\\oracle\\oradata\\DB1\\redo1"},{"{# MPNAME}":"S:\\oracle\\oradata\\DB1\\data1"},{"{#MP NAME}":"M:\\oracle\\oradata\\DB2\\data1"},{"{#MPNA ME}":"M:\\oracle\\oradata\\DB2\\redo2"},{"{#MPNAME }":"M:\\oracle\\oradata\\DB2\\archive2"},{"{#MPNAM E}":"M:\\oracle\\oradata\\DB2\\index1"},{"{#MPNAME }":"M:\\oracle\\oradata\\DB2\\archive1"},{"{#MPNAM E}":"M:\\oracle\\oradata\\DB2\\redo1"}]}
the type of keys that are failing are :-
perf_counter['\LogicalDisk({#MPNAME})\Disk Bytes/sec']
although
vfs.fs.size[{#MPNAME},free] works perfectly.
Any assistance in getting this working would be greatly appreciated, and who knows might help someone else out who has windows guys who want to use mountpoints
Kindest Regards
Tony Mills
I have been trying to get zabbix 2.0.6 to monitor windows mountpoints, i have written some code that queries wmi and produces the names of the Mountpoints, i then munge that into a JSON format and zabbix discovers the Mountpoints perfectly.
using the normal vfs.fs.size keys etc its all fine and working as expected (although i had to escape the backslashes and remove the trailing backslash).
I now want to setup an item prototype for perfmon counters, the perfmon counters themselves work from zabbix_get but when i replace the mountpoint with {#MPNAME} it appears not to be working, i have tried quotes and escapes everywhere but its just not playing ball, Has anyone managed to do this?
for anyone it might be of use to:-
I do have activestate perl so compile a script for windows and add the following to zabbix_agentd.conf
UserParameter=sj.discovery,c:\zabbix2\sj-discovery.exe
my perl script is as follows:-
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('dbi:WMI:');
my $sth = $dbh->prepare(<<WQL);
select name from win32_volume where drivetype=3 AND driveletter=NULL
WQL
$sth->execute();
print "{\"data\":[";
my $i = 1;
while (my @row = $sth->fetchrow) {
if ($i != 1) {print ","};
$row[0] =~ s/\\$//;
$row[0] =~ s/\\/\\\\/g;
print "{\"{\#MPNAME}\":\"$row[0]\"}";
$i++;
};
print "]}";
the JSON that is produced is :-
{"data":[{"{#MPNAME}":"S:\\oracle\\oradata\\DB1\\archive1"} ,{"{#MPNAME}":"S:\\oracle\\oradata\\DB1\\redo2"},{ "{#MPNAME}":"S:\\oracle\\oradata\\DB1\\index1"},{" {#MPNAME}":"S:\\oracle\\oradata\\DB1\\redo1"},{"{# MPNAME}":"S:\\oracle\\oradata\\DB1\\data1"},{"{#MP NAME}":"M:\\oracle\\oradata\\DB2\\data1"},{"{#MPNA ME}":"M:\\oracle\\oradata\\DB2\\redo2"},{"{#MPNAME }":"M:\\oracle\\oradata\\DB2\\archive2"},{"{#MPNAM E}":"M:\\oracle\\oradata\\DB2\\index1"},{"{#MPNAME }":"M:\\oracle\\oradata\\DB2\\archive1"},{"{#MPNAM E}":"M:\\oracle\\oradata\\DB2\\redo1"}]}
the type of keys that are failing are :-
perf_counter['\LogicalDisk({#MPNAME})\Disk Bytes/sec']
although
vfs.fs.size[{#MPNAME},free] works perfectly.
Any assistance in getting this working would be greatly appreciated, and who knows might help someone else out who has windows guys who want to use mountpoints

Kindest Regards
Tony Mills
very pleased!!
Comment