Disk Space used per camera?
Posted: Wed Feb 03, 2010 10:34 pm
Is there an easy way to tell how much disk space each camera is using?
Sure would be nice if someone were to add this as a feature to display as an HTML table...maybe run the job and update the stats each hour or once a day or somethingParanoid wrote:If you cd into the events directory (usually (webroot)/htdocs/zm/events) you will see a directory for each camera. The directories are numbers and have a softlink to them from a link that matches the monitor name.
You can then do "du -sh <directory>" to find out how much space each camera is using.
Code: Select all
#!/bin/sh
du -sh /var/www/events/* > /var/www/spaceused.txt
Code: Select all
#!/bin/bash
cd /var/cache/zoneminder/events
for d in `ls -latr|grep \>|awk '{print $8}'`;do du -sDm $d;done >/tmp/events.tmp
df|grep -v none|grep -v udev >/tmp/disksize.tmp
# Now build html report from data files retrieved...first table is all monitors and data size...
echo "<html><head><title>Disk Utilization by Monitor Report</title></head><body><center>" >/tmp/diskusage.html
echo "<h1>Monitor Usage Report</h1><table>" >>/tmp/diskusage.html
cat /tmp/events.tmp |awk '{print "<tr><td>" $2 "</td><td>" $1 " MB</td></tr>"}' >>/tmp/diskusage.html
echo "</table>" >>/tmp/diskusage.html
echo "<h1>Disk Usage Report</h1><table>" >>/tmp/diskusage.html
echo "<table>" >>/tmp/diskusage.html
cat /tmp/disksize.tmp |awk '{print "<tr><td>" $1 "</td><td>" $2 "</td><td>" $3 "</td><td>" $4 "</td><td>" $5 "</td><td>" $6 "</td></tr>"}' >>/tmp/diskusage.html
echo "</table></html>" >>/tmp/diskusage.html
mv /tmp/diskusage.html /var/www/
Code: Select all
#!/bin/bash
export LANG=en_US.UTF-8
LANG=en_US.UTF-8
cd /var/cache/zoneminder/events
for d in `ls -latr|grep \>|awk '{print $8}'`;do du -sDm $d;done >/tmp/events.tmp
df|grep -v none|grep -v udev >/tmp/disksize.tmp
# Now build html report from data files retrieved...first table is all monitors and data size...
echo "<html><head><title>Disk Utilization by Monitor Report</title></head><body><center>" >/tmp/diskusage.html
echo "<h1>Monitor Usage Report</h1><table>" >>/tmp/diskusage.html
cat /tmp/events.tmp |awk '{print "<tr><td>" $2 "</td><td>" $1 " MB</td></tr>"}' >>/tmp/diskusage.html
echo "</table>" >>/tmp/diskusage.html
echo "<h1>Disk Usage Report</h1><table>" >>/tmp/diskusage.html
echo "<table>" >>/tmp/diskusage.html
cat /tmp/disksize.tmp |awk '{print "<tr><td>" $1 "</td><td>" $2 "</td><td>" $3 "</td><td>" $4 "</td><td>" $5 "</td><td>" $6 "</td></tr>"}' >>/tmp/diskusage.html
echo "</table></html>" >>/tmp/diskusage.html
mv /tmp/diskusage.html /usr/share/zoneminder/