Español   Català  

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 for supernodes that are configured on this server. This machine must have an exit to guifi.net and the internet, since at the moment the server of guifi.net is only accessible from the internet. To read the graphs, the server of guifi.net ask on our server, via the web, the graphic of the nodes that are configured with this server.
+
SNP services are a set of tools that allow you to capture the graphs of nodes and supernodes that are configured on this server.  
  
snpservices és un conjunt d'eines que permetran capturar les gràfiques dels nodes i supernodes que estiguin configurats en aquest servidor. Aquesta màquina haurà de tenir aleshores sortida a guifi.net i a internet, ja que de moment el servidor de guifi.net només està accessible des de internet.
+
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.
Per a llegir les gràfiques, el servidor de guifi.net preguntarà al nostre servidor, via web, les gràfiques dels nodes que estan configurats amb aquest servidor.
+
  
=TRANSLATED UNTIL HERE=
 
= Creació del servei a la web de guifi =
 
Prèviament haurem d'haver afegit un dispositiu tipus '''servidor''' en el nostre supernode i assigar-li una IP de guifi (dispositiu del supernode > editar > secció de connexions per cable > Rang de IPs destinat als server (es crea si no existeix) > endoll > Enllaça dispositiu > crea > Guardar y modificar.
 
  
 +
=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.
  
# Crea continguts
+
# Create contents
 
# guifi.net service
 
# guifi.net service
## '''Service name:''' Servidor de Gràfiques BCNRossello208
+
## '''Service name:''' Graph Server BCNRossello208
## '''Nom curt:''' BCNRossello208-GRAF
+
## '''Short Name:''' BCNRossello208-GRAF
## '''Contactar:''' mail de contacte de l'administrador
+
## '''Contact:''' the email address of the administrator
## '''Dispositiu:''' comencem a escriure el nom del nostre servidor i sortiran els noms dels servidors que comencen així
+
## '''Device:''' start with typing the name of our server and leave the names of the servers that are beeing created
## '''Servei:''' SNP Graph Server   
+
## '''Service:''' SNP Graph Server   
## '''Estat:''' Estat del servei
+
## '''Status:''' Status of service
# Desa
+
# 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
  
Un cop desat, tornem a modificar i canviem alguns valors:
+
= Methodology =
 +
We connect via ssh to the machine and add the Guifi apt repositories:
  
# '''versió:''' 2.0
+
# [[Configure_the_Guifi_apt_repositories|Configure the Guifi apt repositories]]
# '''url:''' URL a la que accedirem a la aplicació web de les gràfiques, normalment http://ipdelservidor/snpservices
+
# install the snp services package <br /><pre># apt-get install snpservices</pre><br />We get a Setup menu that we fill with some data:
# Desa
+
# '''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
= Metodologia =
+
# '''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
Entrem per ssh a la màquina i afegim els repositoris d'apt de guifi:
+
# '''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_
* [[Configurar_Repositori_apt_guifi|Configurar el repositori d'apt de guifi]]
+
# '''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
i instal·lem el paquet snpservices
+
# '''Force to fetch mrtg.cfg now.''' Yes
 
+
<pre># apt-get install snpservices</pre>
+
 
+
Ens sortirà un menú de configuració que ens demanarà algunes dades:
+
 
+
* '''SNP Graph Server Id. (Default: bandoler=6559)''' El numero de id del servei que hem creat a la web de guifi
+
* '''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.
 
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

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.

  1. Create contents
  2. guifi.net service
    1. Service name: Graph Server BCNRossello208
    2. Short Name: BCNRossello208-GRAF
    3. Contact: the email address of the administrator
    4. Device: start with typing the name of our server and leave the names of the servers that are beeing created
    5. Service: SNP Graph Server
    6. Status: Status of service
  3. Save.
    Once saved, we will modify and change some values:
  4. Version: 2.0
  5. Url: URL to which you will return to the graph web application, usually http://<server-ip>/snpservices
  6. Save

Methodology

We connect via ssh to the machine and add the Guifi apt repositories:

  1. Configure the Guifi apt repositories
  2. install the snp services package
    # apt-get install snpservices

    We get a Setup menu that we fill with some data:
  3. SNP Graph Server Id. (Default: bandoler=6559) The id number of the service that we have created a the Guifi website

Translated until here

  1. rootZone: which is the ROOT zone. (Default: 3671) Deixem el valor per defecte 3671
  2. 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
  3. 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=
  4. CNMLSource: url for CNML node query, use sprintf syntax. Deixem el valor per defecte http://www.guifi.net/snpservices/common/qnodes.php?nodes=%s_
  5. rrddb path. Deixem el valor per defecte /var/lib/snpservices/rrdb/
  6. rddimg path. Deixem el valor per defecte /var/lib/snpservices/rrimg/
  7. rddtool version. Deixem el valor per defecte 1.3
  8. 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.

Personal tools