Ad Widget

Collapse

LLD Mountpoint objects and perfmon counters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • br74649
    Junior Member
    • Jun 2011
    • 6

    #1

    LLD Mountpoint objects and perfmon counters

    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
  • bagni
    Senior Member
    Zabbix Certified Specialist
    • Mar 2012
    • 164

    #2
    Hi,
    I've opened the prformance monitor (perfmon) and took a brief look about the \LogicalDisk(*)\Disk Bytes/sec.
    Possible instances are: _Total, C:, D:, HarddiskVolume1, etc.

    So I guess that you don't use the path but only the logical drive, beacuse is not the zabbix item but the performance counter issue.

    Lorenzo

    Comment

    • br74649
      Junior Member
      • Jun 2011
      • 6

      #3
      Hi Lorenzo,

      Thanks for your reply,

      i got that metric from typeperf -qx if i run :-

      root@xxxx:/tmp# zabbix_get -s 172.28.2.87 -k perf_counter['\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk Bytes/sec']
      0.000000

      it works i get "0.000000", from typeperf all the mountpoints have various counters, i just cant seem to get zabbix to work if the mountpoint is replaced with {#MPNAME}.

      Best Regards and thanks again

      Tony
      Last edited by br74649; 22-05-2013, 10:10.

      Comment

      • bagni
        Senior Member
        Zabbix Certified Specialist
        • Mar 2012
        • 164

        #4
        I have different behaviour:
        Code:
        C:\ZabbixAgent>zabbix_agentd.exe -c zabbix_agentd.conf -t "perf_counter[\Logical Disk(C:)\Disk Bytes/sec]"
        perf_counter[\LogicalDisk(C:)\Disk Bytes/sec][\LogicalDisk(C:)\Disk Bytes/sec] [
        d|20513.890999]
        
        C:\ZabbixAgent>zabbix_agentd.exe -c zabbix_agentd.conf -t "perf_counter[\Logical Disk(C:\ZabbixAgent)\Disk Bytes/sec]"
        perf_counter[\LogicalDisk(C:\ZabbixAgent)\Disk Bytes/sec][\LogicalDisk(C:\Zabbix
        Agent)\Disk Bytes/sec] [m|ZBX_NOTSUPPORTED]
        Could you kindly test the item on agent installed on target machine?
        Last edited by bagni; 22-05-2013, 10:17.

        Comment

        • br74649
          Junior Member
          • Jun 2011
          • 6

          #5
          Hi,

          Thanks for your reply, yes i get not supported too when running

          c:\zabbix2>zabbix_agentd.exe -c zabbix_agentd.conf -t perf_counter['\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk Bytes/sec']

          perf_counter['\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk[U☺] [m|ZBX_NOTSUPPORTED]

          Although the cmd shell seems to have replaced "Disk Bytes/sec" with "Disk[U☺]"

          However, I have created a normal item for that host perf_counter[\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk Bytes/sec]

          this works fine and doesn't return unsupported but a value.

          I notice in the logs of the agent i get the following:-

          3280:20130522:092516.134 Requested [perf_counter['\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk Bytes/sec']]
          3280:20130522:092516.134 In PERF_COUNTER()
          3280:20130522:092516.134 cannot get required buffer size for counter path ''\LogicalDisk(M:\oracle\oradata\DB2\redo2)\Disk Bytes/sec'': [0xC0000BC4] The specified counter path could not be interpreted.
          3280:20130522:092516.134 End of PERF_COUNTER()
          3280:20130522:092516.134 Sending back [ZBX_NOTSUPPORTED]

          Best Regards

          Tony

          Comment

          • br74649
            Junior Member
            • Jun 2011
            • 6

            #6
            ah,....

            it was the single quotes around the counter that was causing the problem.

            so you need the ' around it when doing the perfmon counter on the command line using zabbix_get, but need to remove it when doing in the zabbix item prototype.

            I have removed them and it has now started working.

            Thanks everyone for you help.

            i now have mountpoint LLD working with dynamic perfmon counters and everything very pleased!!

            feel free to use the above script if anyone else needs to do this and like me doesnt really do powershell!!

            Thanks again

            regards

            Tony

            Comment

            Working...