Disk Stats not working with Cacti plugins v1.04

I tried searching to see if this was posted before, but oddly, there doesn’t seem to be a way to search these forums?

I am trying to collect disk stats on my server and, according to this:
[URL]http://www.percona.com/doc/percona-monitoring-plugins/cacti/linux-templates.html[/URL]
I need to use the volume name.

I’ve actually tried just about every permutation of this that I can think of, none of which return values.
On my server, I have:

# lsblk 
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 9.1T 0 disk 
├─sda1 8:1 0 1M 0 part 
├─sda2 8:2 0 244M 0 part /boot
└─sda3 8:3 0 9.1T 0 part 
├─lzbfs-root (dm-0) 252:0 0 9T 0 lvm /
└─lzbfs-swap_1 (dm-1) 252:1 0 96G 0 lvm 
sr0 11:0 1 1024M 0 rom 

And

# pvdisplay 
--- Physical volume ---
PV Name /dev/sda3
VG Name lzbfs
PV Size 9.09 TiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 2383298
Free PE 0
Allocated PE 2383298
PV UUID SuoiPA-4Dgl-K6zd-Qqdx-KYdT-2U2D-GsxdjK

I need to get stats for lzbfs-root. I have tried the following, but all return -1:

/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume lzbfs-root
jw:-1 jx:-1
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume sda3
jw:-1 jx:-1
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume /dev/sda3
jw:-1 jx:-1
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume dm-0
jw:-1 jx:-1
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume /
jw:-1 jx:-1
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume lzbfs
jw:-1 jx:-1

As I understand the docs, it is supposed to work using the volume name from lsblk…in my case “lzbfs-root”, but it doesn’t seem to work.
Can someone explain what I am doing wrong?

NB:
Other commands from get_by_ssh.php that are not disk related do work correctly.

Please show me your “df” output. The volume should be the way it is listed in the first column of “df” output.

~# df
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/lzbfs-root 9.0T 174G 8.9T 2% /
udev 48G 12K 48G 1% /dev
tmpfs 19G 628K 19G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 48G 92K 48G 1% /run/shm
/dev/sda2 229M 29M 188M 14% /boot

You have to use “/dev/mapper/lzbfs-root”, i.e.
/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume /dev/mapper/lzbfs-root

I actually tried that before (just forgot to list it) and it doesn’t work:

/usr/bin/php -q /usr/share/cacti/site/scripts/ss_get_by_ssh.php --host 192.168.28.29 --type df --items jw,jx --volume /dev/mapper/lzbfs-root
jw:-1 jx:-1

‘DISKFREE_used’ => ‘nj’,
‘DISKFREE_available’ => ‘nk’,

It should be --items nj,nk. Also please check that the script from PMP 1.0.4 tarball or package.

I had a similar issue. Out of all of my servers, a couple of them would not report disk space. However, the other disk graphs worked fine such as Disk IOPS and Disk Read/Write/Time.

I saw the following error in my log file:

When I ran the script manually, I got the correct results:

/usr/share/cacti/scripts/ss_get_by_ssh.php --host ‘192.168.14.2’ --type df --items nj,nk --volume ‘/dev/mapper/centos-root’

nj:62762065920 nk:98220564480

However, that was as the root user. When I ran the script as the Cacti user, it failed.

su cacti

bash-4.2$ /bin/php -q /usr/share/cacti/scripts/ss_get_by_ssh.php --host ‘192.168.14.2’ --type df --items nj,nk --volume ‘/dev/mapper/centos-root’
PHP Warning: fopen(/tmp/192.168.14.2__dev_mapper_centos-root_df_cacti_stats.txt): failed to open stream: Permission denied in /var/lib/cacti/scripts/ss_get_by_ssh.php on line 527

Sure enough, there was a file in /tmp that was owned by root

I deleted all the files like this in file as root.

CMD: /bin/php -q /usr/share/cacti/scripts/ss_get_by_ssh.php --host ‘192.168.14.2’ --type df --items nj,nk --volume ‘/dev/mapper/centos-root’, output: nj:62763327488 nk:98219302912

–volume '/dev/mapper/centos-root ’

Thank you for updating this post with your solution, it could save someone a lot of time in the future. Appreciated!