Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added update script, better install, support for resize
  • Loading branch information
bivald committed Oct 30, 2010
1 parent 5e835b3 commit df11129
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
8 changes: 8 additions & 0 deletions install.sh
Expand Up @@ -10,6 +10,7 @@ echo "And copy the following files:"
echo " ./munin-mobile.conf -> /etc/munin/munin-mobile.conf"
echo " ./templates-mobiles/* -> /etc/munin/templates-mobiles/"
echo " ./mobile-www/* -> /var/www/munin/mobile/*"
echo " ./update-mobile.sh -> /etc/munin/update-mobile.sh"
echo ""
echo "It also sets the permissions to the same as your munin files"
echo ""
Expand Down Expand Up @@ -62,6 +63,13 @@ fi
cp -r `pwd`/mobile-www/* /var/www/munin/mobile
chown -R /var/www/munin/mobile --reference=/var/www/munin

echo "- ./update-mobile.sh -> /etc/munin/update-mobile.sh"

cp update-mobile.sh /etc/munin/
chown /etc/munin/update-mobile.sh --reference=/etc/munin/munin-mobile.conf

chmod 755 /etc/munin/update-mobile.sh

echo ""
echo "Finished!"

2 changes: 2 additions & 0 deletions munin-mobile.conf
Expand Up @@ -11,6 +11,8 @@ rundir /var/run/munin
# Where to look for the HTML templates
tmpldir /etc/munin/templates-mobiles



# Make graphs show values per minute instead of per second
#graph_period minute

Expand Down
2 changes: 1 addition & 1 deletion templates-mobiles/munin-nodeview.tmpl
Expand Up @@ -39,7 +39,7 @@
<TMPL_LOOP NAME="SERVICES">
<li>
<h3><a href="<TMPL_VAR NAME="URL">"><TMPL_VAR ESCAPE="HTML" NAME="LABEL"></a></h3>
<p><img src="/munin/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGDAY">" alt="<TMPL_VAR ESCAPE="HTML" NAME="LABEL">" class="imgday" width="300" height="162"></p>
<p><img src="<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGDAY">" alt="<TMPL_VAR ESCAPE="HTML" NAME="LABEL">" class="imgday" width="300" height="162"></p>
</li>
</TMPL_LOOP>
</li>
Expand Down
8 changes: 4 additions & 4 deletions templates-mobiles/munin-serviceview.tmpl
Expand Up @@ -30,10 +30,10 @@
<TMPL_LOOP NAME="SERVICES">
<p>

<img src="/munin/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGDAY">" alt="daily graph" class="img_service"><br>
<img src="/munin/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGWEEK">" alt="weekly graph" class="img_service"><br>
<img src="/munin/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGMONTH">" alt="monthly graph" class="img_service"><br>
<img src="/munin/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGYEAR">" alt="yearly graph" class="img_service"><br>
<img src="<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGDAY">" alt="daily graph" class="img_service"><br>
<img src="<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGWEEK">" alt="weekly graph" class="img_service"><br>
<img src="<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGMONTH">" alt="monthly graph" class="img_service"><br>
<img src="<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="IMGYEAR">" alt="yearly graph" class="img_service"><br>
</p>
<table width='100%'>
<TMPL_LOOP NAME="GRAPHINFO">
Expand Down
26 changes: 26 additions & 0 deletions update-mobile.sh
@@ -0,0 +1,26 @@
#!/bin/bash

#
# Updates the graphs, html and resizes the images
#

/usr/share/munin/munin-graph --config=/etc/munin/munin-mobile.conf
/usr/share/munin/munin-html --config=/etc/munin/munin-mobile.conf

# Find images in mobile dir, files, *.png, modified between 0 and 3 minutes, not including images, resize with mogrify
find /var/www/munin/mobile/ -type f -name "*.png" -mmin +0 -mmin -3 -not -wholename "*images/*" -exec mogrify -resize 300 "{}" \;

# Old, obsolete labour intensive resize

exit
cd /var/www/munin/mobile

for file in `dir -d *` ; do
if [ -d "/var/www/munin/mobile/$file" ]
then
if [ $file != "images" ] # Dont resize our template images, we probably should check css/js here as well...
then
/usr/bin/mogrify -resize 300 /var/www/munin/mobile/$file/*.png
fi
fi
done

0 comments on commit df11129

Please sign in to comment.