Difference between revisions of "Graphserver 1"
From Guifi.net - English Wiki
(→Create Article by translation, incomplete) |
(→Methodology) |
||
(3 intermediate revisions by one user not shown) | |||
Line 2: | Line 2: | ||
= Introduction = | = Introduction = | ||
− | SNP services are a set of tools that allow you to capture the graphs of nodes and | + | SNP services are a set of tools that allow you to capture the graphs of nodes and supernodes that are configured on this server. |
− | + | This machine must have one exit to guifi.net and one to the internet as soon as the guifi.net server is accessible only by internet. The server of guifi.net ask our server via web for the graphs of the nodes that are configured on it. | |
− | + | ||
− | |||
− | |||
− | |||
+ | =Create a server at guif.net = | ||
+ | Previously we have have to add a device type '''server''' to our supernode and assign the guifi IP (supernode device > edit > cable connections section > range of IPs assigned to the server (will be created if it doesn't exist) > plug > link device > device creates > Save and modify. | ||
− | # | + | # Create contents |
# guifi.net service | # guifi.net service | ||
− | ## '''Service name:''' | + | ## '''Service name:''' Graph Server BCNRossello208 |
− | ## ''' | + | ## '''Short Name:''' BCNRossello208-GRAF |
− | ## ''' | + | ## '''Contact:''' the email address of the administrator |
− | ## ''' | + | ## '''Device:''' start with typing the name of our server and leave the names of the servers that are beeing created |
− | ## ''' | + | ## '''Service:''' SNP Graph Server |
− | ## ''' | + | ## '''Status:''' Status of service |
− | # | + | # Save. <br/>Once saved, we will modify and change some values: |
+ | # '''Version:''' 2.0 | ||
+ | # '''Url:''' URL to which you will return to the graph web application, usually ''<nowiki>http://<server-ip>/snpservices</nowiki>'' | ||
+ | # Save | ||
− | + | = Methodology = | |
+ | We connect via ssh to the machine and add the Guifi apt repositories: | ||
− | # | + | # [[Configure_the_Guifi_apt_repositories|Configure the Guifi apt repositories]] |
− | + | # install the snp services package <br /><pre># apt-get install snpservices</pre><br />We get a Setup menu that we fill with some data: | |
− | + | # '''SNP Graph Server Id. (Default: bandoler=6559)''' The id number of the service that we have created a the Guifi website | |
− | + | ==Translated until here== | |
− | + | # '''rootZone: which is the ROOT zone. (Default: 3671)''' Deixem el valor per defecte 3671 | |
− | + | # '''SNPDataServer_url: without ending backslash, the url where the data is. (Default: http://snpservices.guifi.net)''' Deixem el valor per defecte http://snpservices.guifi.net | |
− | + | # '''MRTGConfigSource: mrtg csv data. (Only URL, Graph Server Id will be concatenated)''' Deixem el valor per defecte http://www.guifi.net/snpservices/graphs/cnml2mrtgcsv.php?server= | |
− | + | # '''CNMLSource: url for CNML node query, use sprintf syntax.''' Deixem el valor per defecte http://www.guifi.net/snpservices/common/qnodes.php?nodes=%s_ | |
− | + | # '''rrddb path.''' Deixem el valor per defecte /var/lib/snpservices/rrdb/ | |
− | + | # '''rddimg path.''' Deixem el valor per defecte /var/lib/snpservices/rrimg/ | |
− | + | # '''rddtool version.''' Deixem el valor per defecte 1.3 | |
− | + | # '''Force to fetch mrtg.cfg now.''' Yes | |
− | + | ||
− | <pre># apt-get install snpservices</pre> | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
I començarà a descarregar el fitxer mrtg.cfg corresponent al servidor de gràfiques definit en el punt 1. | I començarà a descarregar el fitxer mrtg.cfg corresponent al servidor de gràfiques definit en el punt 1. | ||
Line 60: | Line 48: | ||
<pre># ln -s /usr/share/snpservices /var/www/snpservices</pre> | <pre># ln -s /usr/share/snpservices /var/www/snpservices</pre> | ||
− | |||
= Ampliació = | = Ampliació = |
Latest revision as of 11:20, 26 April 2014
Contents
Introduction
SNP services are a set of tools that allow you to capture the graphs of nodes and supernodes that are configured on this server.
This machine must have one exit to guifi.net and one to the internet as soon as the guifi.net server is accessible only by internet. The server of guifi.net ask our server via web for the graphs of the nodes that are configured on it.
Create a server at guif.net
Previously we have have to add a device type server to our supernode and assign the guifi IP (supernode device > edit > cable connections section > range of IPs assigned to the server (will be created if it doesn't exist) > plug > link device > device creates > Save and modify.
- Create contents
- guifi.net service
- Service name: Graph Server BCNRossello208
- Short Name: BCNRossello208-GRAF
- Contact: the email address of the administrator
- Device: start with typing the name of our server and leave the names of the servers that are beeing created
- Service: SNP Graph Server
- Status: Status of service
- Save.
Once saved, we will modify and change some values: - Version: 2.0
- Url: URL to which you will return to the graph web application, usually http://<server-ip>/snpservices
- Save
Methodology
We connect via ssh to the machine and add the Guifi apt repositories:
- Configure the Guifi apt repositories
- install the snp services package
# apt-get install snpservices
We get a Setup menu that we fill with some data: - SNP Graph Server Id. (Default: bandoler=6559) The id number of the service that we have created a the Guifi website
Translated until here
- rootZone: which is the ROOT zone. (Default: 3671) Deixem el valor per defecte 3671
- SNPDataServer_url: without ending backslash, the url where the data is. (Default: http://snpservices.guifi.net) Deixem el valor per defecte http://snpservices.guifi.net
- MRTGConfigSource: mrtg csv data. (Only URL, Graph Server Id will be concatenated) Deixem el valor per defecte http://www.guifi.net/snpservices/graphs/cnml2mrtgcsv.php?server=
- CNMLSource: url for CNML node query, use sprintf syntax. Deixem el valor per defecte http://www.guifi.net/snpservices/common/qnodes.php?nodes=%s_
- rrddb path. Deixem el valor per defecte /var/lib/snpservices/rrdb/
- rddimg path. Deixem el valor per defecte /var/lib/snpservices/rrimg/
- rddtool version. Deixem el valor per defecte 1.3
- Force to fetch mrtg.cfg now. Yes
I començarà a descarregar el fitxer mrtg.cfg corresponent al servidor de gràfiques definit en el punt 1.
En aquest punt ja podem accedir al servei snpservices via web a aquesta url:
http://ipdelservidor/snpservices
Si no funciona comprova que tinguis un enllaç simbòlic a /var/www que es digui snpservices i apunti a /usr/share/snpservices, si no existeix, crea'l.
# ln -s /usr/share/snpservices /var/www/snpservices
Ampliació
El servidor va desant la informació que li envien els nodes gràcies a uns scripts que veiem a /etc/cron.d/snpservices
fermat:~# cat /etc/cron.d/snpservices */30 * * * * root if [ -x /var/www/snpservices/graphs ]; then cd /var/www/snpservices/graphs ; fi; if [ -x /usr/bin/php ] && [ -r /var/www/snpservices/graphs/mrtgcsv2mrtgcfg.php ]; then env LANG=C /usr/bin/php mrtgcsv2mrtgcfg.php >> /var/log/snpservices/mrtgccfg.log 2>&1;fi */5 * * * * root if [ ! -x /var/lock/mrtg ]; then mkdir /var/lock/mrtg ; fi; if [ -x /usr/bin/mrtg ] && [ -r /var/lib/snpservices/data/mrtg.cfg ]; then env LANG=C /usr/bin/mrtg /var/lib/snpservices/data/mrtg.cfg --lock-file /var/lock/mrtg/guifi_l >> /var/log/snpservices/mrtg.log 2>&1; fi
El snpservices de la nostra màquina està configurat per tal de preguntar-li a la web de guifi quins nodes n'ha de guardar les gràfiques. Els scripts s'executen cada 5 minuts per a recollir les dades i cada mitja hora per a saber quins nodes s'han de graficar.
Si volem fer un backup de les dades que està recol·lectant el servidor de gràfiques copiem el contingut del directori /var/lib/snpservices. A /usr/share/snpservices hi ha els fitxers de l'aplicació.
Configurar un virtualhost d'apache per al servei
Com ens agrada complicar les coses (o deixar-les una mica ordenades), crearem un subdomini que es dirà graf1, vaig al DNS i apunto el subdomini a la ip d'internet d'aquesta màquina i configuro el virtualhost apuntant al directori snpservices que és un link simbòlic (important afegir la opció FollowSymLinks). Aquest pas és opcional.
# vi /etc/apache2/sites-available/graf1.marsupi.org <VirtualHost *:80> ServerAdmin marsupi@marsupi.org ServerAlias graf1.marsupi.org *.graf1.marsupi.org ServerName graf1.marsupi.org DocumentRoot /usr/share/snpservices #habilitar en cas de debugging #ErrorLog /var/log/apache2/graf1.marsupi.org_error.log #LogLevel warn #CustomLog /var/log/apache2/graf1.marsupi.org_access.log combined <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /usr/share/snpservices> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> </VirtualHost>
Carreguemt el fitxer de configuració a l'apache
# a2ensite graf1.marsupi.org
I reiniciem el servei
# service apache2 restart
Agraïments
Thnks Zunbado i Locke.