diff options
author | Kurt Jaeger <pi@FreeBSD.org> | 2014-08-04 09:18:27 +0000 |
---|---|---|
committer | Kurt Jaeger <pi@FreeBSD.org> | 2014-08-04 09:18:27 +0000 |
commit | b8129d8b0f3f707b296bee42a8a01b21c4c860d0 (patch) | |
tree | 9f57965de3f7de7af33024e9608535039586c9e2 /net-mgmt/guifi-snpservices/files | |
parent | e71e62b1177e76afa7c122c95b48b1dfb74d77cb (diff) | |
download | ports-b8129d8b0f3f707b296bee42a8a01b21c4c860d0.tar.gz ports-b8129d8b0f3f707b296bee42a8a01b21c4c860d0.zip |
Notes
Diffstat (limited to 'net-mgmt/guifi-snpservices/files')
12 files changed, 258 insertions, 0 deletions
diff --git a/net-mgmt/guifi-snpservices/files/patch-common-config.php.template b/net-mgmt/guifi-snpservices/files/patch-common-config.php.template new file mode 100644 index 000000000000..0e66c09e525c --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-config.php.template @@ -0,0 +1,64 @@ +--- common/config.php.template.orig 2014-02-21 15:53:13.000000000 +0000 ++++ common/config.php.template 2014-04-10 13:41:47.000000000 +0000 +@@ -1,10 +1,10 @@ + <?php + + // snp_pat: full directory where snp services are located +-$snp_path='/var/www/html/snpservices'; ++$snp_path='/usr/local/www/snpservices'; + + // SNPGraphServerID: Default Graph Server ID +-$SNPGraphServerId = 6579; ++$SNPGraphServerId = 67063; + + // rootZone: which is the ROOT zone + $rootZone = 3671; +@@ -15,21 +15,21 @@ + // MRTGConfigSource: mrtg csv data + // As a input, could be either a local (to be created from + // cached CNML file, or remote +-$MRTGConfigSource='http://proves.elserrat.guifi.net/snpservices/graphs/cnml2mrtgcsv.php'; +-//$MRTGConfigSource='../data/guifi_mrtg.csv'; ++$MRTGConfigSource='http://guifi.net/snpservices/graphs/cnml2mrtgcsv.php?server='.$SNPGraphServerId; ++//$MRTGConfigSource='/var/tmp/snpservices/data/guifi_mrtg.csv'; + + // CNMLSource: url for CNML node query, use sprintf syntax + // MySQL-drupal source +-//$CNMLSource='http://proves.elserrat.guifi.net/guifi/cnml/%s/node'; ++//$CNMLSource='http://guifi.net/guifi/cnml/%s/node'; + // Cached CNML source (prefered) +-$CNMLSource='http://proves.elserrat.guifi.net/snpservices/common/qnodes.php?nodes=%s'; ++$CNMLSource='http://guifi.net/snpservices/common/qnodes.php?nodes=%s'; + +-$CNMLData='../data/guifi.cnml'; ++$CNMLData='/var/tmp/snpservices/data/guifi.cnml'; + + // rrdtool parameters +-$rrdtool_path='/usr/bin/rrdtool'; +-$rrddb_path='/home1/comesfa/mrtg/logs/'; +-$rrdimg_path='/home1/comesfa/mrtg/images/'; ++$rrdtool_path='/usr/local/bin/rrdtool'; ++$rrddb_path='/var/tmp/snpservices/logs/'; ++$rrdimg_path='/var/tmp/snpservices/images/'; + + // which version does have this server? + // currently supported versions are: +@@ -38,8 +38,7 @@ + $rrdtool_version = "1.3"; + + // mrtg local header +-$rrdtool_header='# PathAdd: /usr/local/rrdtool-1.2.12/bin +-# LibAdd: /usr/local/rrdtool-1.2.12/lib/perl/5.8.8/i386-linux-thread-multi ++$rrdtool_header='PathAdd: /usr/local/bin/ + HtmlDir: %s + ImageDir: %s + LogDir: %s +@@ -57,7 +56,7 @@ + <TR><TD>Description:</TD><TD>ping</TD></TR> + <TR><TD>IP:</TD> <TD>%s</TD></TR> + </TABLE> +-Target[%s_ping]: `/etc/mrtg/ping.sh %s` ++Target[%s_ping]: `sh '.$snp_path.'/common/ping.sh %s` + MaxBytes[%s_ping]: 2000 + Options[%s_ping]: growright,unknaszero,nopercent,gauge + LegendI[%s_ping]: Perduts % diff --git a/net-mgmt/guifi-snpservices/files/patch-common-misc.php b/net-mgmt/guifi-snpservices/files/patch-common-misc.php new file mode 100644 index 000000000000..899eede0907d --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-misc.php @@ -0,0 +1,20 @@ +--- common/misc.php.orig 2014-04-10 14:05:20.000000000 +0000 ++++ common/misc.php 2014-04-10 14:05:45.000000000 +0000 +@@ -177,7 +177,7 @@ + foreach ($an as $nc) { + $try = 0; + $xml = false; +- $fn = $prefix.'tmp/'.$nc.'.cnml'; ++ $fn = $prefix.'/var/tmp/snpservices/tmp/'.$nc.'.cnml'; + do { + // print " Processing $nc try $try cache: $waitcache\n<br>"; + if (file_exists($fn)) { +@@ -232,7 +232,7 @@ + if ($xml) { + $xpnxml = $xml->xpath('//node'); + foreach ($xpnxml as $nxml) { +- $fn = $prefix.'tmp/'.$nxml->attributes()->id.'.cnml'; ++ $fn = $prefix.'/var/tmp/snpservices/tmp/'.$nxml->attributes()->id.'.cnml'; + $wcnml = @fopen($fn, "w+") or die("\n<br>Error caching XML, can't write $fn\n"); + fwrite($wcnml,'<cnml>'.$nxml->asXML().'</cnml>'); + fclose($wcnml); diff --git a/net-mgmt/guifi-snpservices/files/patch-common-ping.sh b/net-mgmt/guifi-snpservices/files/patch-common-ping.sh new file mode 100644 index 000000000000..6da57a01b14e --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-ping.sh @@ -0,0 +1,22 @@ +--- ./common/ping.sh.orig 2014-02-21 15:53:13.000000000 +0000 ++++ ./common/ping.sh 2014-04-10 14:19:56.000000000 +0000 +@@ -1,15 +1,15 @@ + #!/bin/sh +- PING="/bin/ping" ++ PING="/sbin/ping" + ADDR=$1 +- DATA=`$PING -c5 -i 0.2 $ADDR -q -W 4` ++ DATA=`$PING -c 5 -i 0.2 -q -W 4 $ADDR` + LOSS=`echo $DATA | awk '{print $18 }' | tr -d %` + ERRORS=`echo $DATA | awk '{print $19 }' | tr -d %` +- if [ $ERRORS = "errors," ] ++ if [ "$ERRORS" = "errors," ] + then + LOSS=`echo $DATA | awk '{print $20 }' | tr -d %` + fi + echo $LOSS +- if [ $LOSS = 100 ]; ++ if [ "$LOSS" = 100 ]; + then + echo 0 + else diff --git a/net-mgmt/guifi-snpservices/files/patch-common-qnodes.php b/net-mgmt/guifi-snpservices/files/patch-common-qnodes.php new file mode 100644 index 000000000000..16d67bac4454 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-qnodes.php @@ -0,0 +1,11 @@ +--- common/qnodes.php.orig 2014-04-10 12:44:55.000000000 +0000 ++++ common/qnodes.php 2014-04-10 12:45:28.000000000 +0000 +@@ -19,7 +19,7 @@ + // Opening CNML source + $doc = new DOMDocument; + $doc->preserveWhiteSpace = false; +-$doc->Load('../data/guifi.cnml'); ++$doc->Load('/var/tmp/snpservices/data/guifi.cnml'); + + // building the xpath query for requested nodes + $xpath = new DOMXPath($doc); diff --git a/net-mgmt/guifi-snpservices/files/patch-common-refresh_cnml.php b/net-mgmt/guifi-snpservices/files/patch-common-refresh_cnml.php new file mode 100644 index 000000000000..ff7a9b5c6696 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-refresh_cnml.php @@ -0,0 +1,19 @@ +--- common/refresh_cnml.php.orig 2014-04-10 12:41:40.000000000 +0000 ++++ common/refresh_cnml.php 2014-04-10 12:43:16.000000000 +0000 +@@ -27,14 +27,14 @@ + echo "Getting CNML file\n"; + $hcnml = @fopen($SNPDataServer_url."/guifi/cnml/".$rootZone."/detail", "r") + or die ('Error redaing CNML source\n'); +- $wcnml = @fopen("../data/guifi.cnml.tmp", "w"); ++ $wcnml = @fopen("/var/tmp/snpservices/data/guifi.cnml.tmp", "w"); + while (!feof($hcnml)) { + $buffer = fgets($hcnml, 4096); + fwrite($wcnml,$buffer); + } + fclose($hcnml); + fclose($wcnml); +- exec ("/bin/cp ../data/guifi.cnml.tmp ../data/guifi.cnml"); ++ exec ("/bin/cp /var/tmp/snpservices/data/guifi.cnml.tmp /var/tmp/snpservices/data/guifi.cnml"); + + $hlast= @fopen("/tmp/last_update.cnml", "w") or die('Error!'); + fwrite($hlast,$last_now); diff --git a/net-mgmt/guifi-snpservices/files/patch-common-refresh_mrtg.php b/net-mgmt/guifi-snpservices/files/patch-common-refresh_mrtg.php new file mode 100644 index 000000000000..a2fc3c710268 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-common-refresh_mrtg.php @@ -0,0 +1,11 @@ +--- common/refresh_mrtg.php.orig 2014-04-10 12:44:08.000000000 +0000 ++++ common/refresh_mrtg.php 2014-04-10 12:44:27.000000000 +0000 +@@ -29,7 +29,7 @@ + + echo "Getting MRTG CSV file\n"; + $hcnml = @fopen($MRTGConfigSource, "r"); +- $wcnml = @fopen("../data/guifi_mrtg.csv", "w"); ++ $wcnml = @fopen("/var/tmp/snpservices/data/guifi_mrtg.csv", "w"); + while (!feof($hcnml)) { + $buffer = fgets($hcnml, 4096); + fwrite($wcnml,$buffer); diff --git a/net-mgmt/guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php b/net-mgmt/guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php new file mode 100644 index 000000000000..3ec2c299ad50 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-graphs-cnml2mrtgcsv.php @@ -0,0 +1,11 @@ +--- graphs/cnml2mrtgcsv.php.orig 2014-04-10 12:35:09.000000000 +0000 ++++ graphs/cnml2mrtgcsv.php 2014-04-10 12:35:19.000000000 +0000 +@@ -267,7 +267,7 @@ + // Opening CNML source + $cnml = new DOMDocument; + $cnml->preserveWhiteSpace = false; +-$cnml->Load('../data/guifi.cnml'); ++$cnml->Load('/var/tmp/snpservices/data/guifi.cnml'); + $time_s = microtime(true); + //print "# file guifi.cnml loaded".($time_s - $time_start)."\n"; + diff --git a/net-mgmt/guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php b/net-mgmt/guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php new file mode 100644 index 000000000000..a399bded50f7 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-graphs-mrtgcsv2mrtgcfg.php @@ -0,0 +1,24 @@ +--- graphs/mrtgcsv2mrtgcfg.php.orig 2014-02-21 15:53:13.000000000 +0000 ++++ graphs/mrtgcsv2mrtgcfg.php 2014-04-10 12:35:33.000000000 +0000 +@@ -1,9 +1,9 @@ + <?php + +-if (file_exists("../common/config.php")) { +- include_once("../common/config.php"); ++if (file_exists(dirname(__FILE__)."../common/config.php")) { ++ include_once(dirname(__FILE__)."../common/config.php"); + } else { +- include_once("../common/config.php.template"); ++ include_once(dirname(__FILE__)."/../common/config.php.template"); + } + + $now = time(); +@@ -57,7 +57,7 @@ + print date('Y/m/d H:i:s')."\n"; + + $hf = @fopen($MRTGConfigSource,"r") or die('Error reading MRTG csv input\n"'); +-$cf = @fopen('../data/mrtg.cfg','w+'); ++$cf = @fopen('/var/tmp/snpservices/data/mrtg.cfg','w+'); + + fputs($cf,sprintf($rrdtool_header,$rrdimg_path,$rrdimg_path,$rrddb_path,$rrddb_path)); + diff --git a/net-mgmt/guifi-snpservices/files/patch-index.php b/net-mgmt/guifi-snpservices/files/patch-index.php new file mode 100644 index 000000000000..8a7d01747c03 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/patch-index.php @@ -0,0 +1,17 @@ +--- ./index.php.orig 2012-05-11 16:46:51.000000000 -0500 ++++ ./index.php 2014-01-27 23:43:35.000000000 -0600 +@@ -5,6 +5,6 @@ + * Main call to CNML services + */ + + // Common Bootstrap + if (file_exists('common/config.php')) + include_once("common/config.php"); +@@ -91,6 +93,7 @@ + echo "Available services:\n"; + $fservices = glob('services/*.php'); + ++ $services = array(); + foreach ($fservices as $fservice) + $services[] .= basename($fservice,'.php'); + echo implode('|',$services); diff --git a/net-mgmt/guifi-snpservices/files/pkg-deinstall.in b/net-mgmt/guifi-snpservices/files/pkg-deinstall.in new file mode 100644 index 000000000000..cf15675b5631 --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/pkg-deinstall.in @@ -0,0 +1,2 @@ +#!/bin/sh +rm -rf %%SNPSERVICES_TMPDIR%% diff --git a/net-mgmt/guifi-snpservices/files/pkg-install.in b/net-mgmt/guifi-snpservices/files/pkg-install.in new file mode 100644 index 000000000000..67186d9c314e --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/pkg-install.in @@ -0,0 +1,26 @@ +#!/bin/sh +CHMOD="/bin/chmod" +MKDIR="/bin/mkdir -p" + +SNPSERVICES_TMPDIR=%%SNPSERVICES_TMPDIR%% + +case "$2" in + +POST-INSTALL) + if [ ! -d "${SNPSERVICES_TMPDIR}/images" ]; then + ${MKDIR} "${SNPSERVICES_TMPDIR}/images" + fi + if [ ! -d "${SNPSERVICES_TMPDIR}/logs" ]; then + ${MKDIR} "${SNPSERVICES_TMPDIR}/logs" + fi + if [ ! -d "${SNPSERVICES_TMPDIR}/data" ]; then + ${MKDIR} "${SNPSERVICES_TMPDIR}/data" + fi + if [ ! -d "${SNPSERVICES_TMPDIR}/tmp" ]; then + ${MKDIR} "$SNPSERVICES_TMPDIR" + ${MKDIR} "${SNPSERVICES_TMPDIR}/tmp" + ${CHMOD} -R a+rw ${SNPSERVICES_TMPDIR}/tmp + fi + ;; +esac +exit 0 diff --git a/net-mgmt/guifi-snpservices/files/pkg-message.in b/net-mgmt/guifi-snpservices/files/pkg-message.in new file mode 100644 index 000000000000..ececebcdce1d --- /dev/null +++ b/net-mgmt/guifi-snpservices/files/pkg-message.in @@ -0,0 +1,31 @@ + +POST-INSTALL CONFIGURATION FOR GUIFI SNPSERVICES +------------------------------------------------ + +1) Install and/or configure a webserver of your choice to serve + php files from %%WWWDIR%%/ (you also might have to + increase your webserver's upstream timeout for certain requests + +2) Edit %%WWWDIR%%/common/config.php.template and set + $SNPGraphServerId to your service's ID (note, it's the *service*, + NOT the "server" ID) + +3) setup a cronjob to keep your graphs and stats up to date; for + example: + +*/30 * * * * root if [ -x %%WWWDIR%%/graphs ]; then cd %%WWWDIR%%/graphs; fi; if [ -x %%PREFIX%%/bin/php ] && [ -r %%WWWDIR%%/graphs/mrtgcsv2mrtgcfg.php ]; then env LANG=C %%PREFIX%%/bin/php mrtgcsv2mrtgcfg.php >> /var/log/snpservices_mrtgcfg.log 2>&1; fi +*/5 * * * * root if [ -x %%PREFIX%%/bin/mrtg ] && [ -r /var/tmp/snpservices/data/mrtg.cfg ]; then env LANG=C %%PREFIX%%/bin/mrtg /var/tmp/snpservices/data/mrtg.cfg --lock-file /var/tmp/mrtg/lockfile_guifi >> /var/log/snpservices_mrtg.log 2>&1; fi + +4) consider logrotating /var/log/snpservices_*.log + +For more information, see various guifi.net doc pages, and related: + + http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas + http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas_1 + http://es.wiki.guifi.net/wiki/Servidor_de_gr%C3%A1ficas_2 + http://www3.uji.es/~vrubert/guifi_linux/graph.html#slide1 + http://es.wiki.guifi.net/wiki/Monitor + http://guifi.net/ca/node/9071 + +------------------------------------------------ + |