You are on page 1of 2

To Install NX on a Linux server:

1. First, you need to exchange public keys between the NX server and MRTG server, so when using scp command to copy the CSV file from the NX to the MRTG, there would be no need to insert a password and it can be done automatically with a script. If you know how to do it, please go ahead and do it and skip this section. a. Unzip the NXtoMRTG.zip folder. b. Copy the content of the folder to the NX Linux server (create a new folder opt/allot/NXtoMRTG and copy all files to it). The folder Linux MRTG Server is meant for the MRTG and there is no need to copy it to the NX. c. Generate key for exchange by running the command ssh-keygen -t dsa -b 1024
[root@CS-Linux-NX ~]# ssh-keygen -t dsa -b 1024 Generating public/private dsa key pair. Enter file in which to save the key (/root/.ssh/id_dsa): /root/.ssh/id_dsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_dsa. Your public key has been saved in /root/.ssh/id_dsa.pub. The key fingerprint is: 7d:32:fc:06:b7:0f:51:ec:c5:7c:14:f3:24:3e:25:0c root@CS-Linux-NX [root@CS-Linux-NX ~]#

d. If you already have keys generated before, you can choose n when asked if you wish to Overwrite. e. For all other options, press enter (no need to change the location where to save the keys and no need for passphrase). In the NXtoMRTG folder youll find a script called add_ssh_server. The script works only with root user. f. After the keys were generated, run the add_ssh_server script. The script will ask you to enter the MRTG server IP and the root password of the MRTG server:
[root@CS-Linux-NX ~]# ./add_ssh_server

g. Type in the ip address of the server device to add your user as trusted:
10.17.13.13 root@10.17.13.13's password: root@10.17.13.13's password: [root@CS-Linux-NX ~]#

h. At this stage, you should be able to SSH the MRTG server from the NX or copy files without the need to enter a password. Perform a quick test and verify you can access without the need to enter password:
[root@CS-Linux-NX ~]# ssh 10.17.13.13 Last login: Sun Mar 1 18:49:26 2009 from 10.17.13.11 [root@localhost ~]#

i.

Edit run.sh file with the correct MRTG IP address and destination folder on MRTG to copy the files in the scp command:
#10.17.13.13 - MRTG_IP #/home/allot - destination directory on the MRTG to copy the csv scp Pipe_Top50_5Min.csv root@10.17.13.13:/home/allot >> /opt/allot/NXtoMRTG/NXtoMRTG.log

In this example, the MRTG server is 10.17.13.13 and the directory on the MRTG the NX needs to copy the files to, is /home/allot Run the run.sh script once and make sure the CSV file called Pipe_Top50_5Min.csv was created with the current timestamp and that it contains statistics information on active pipes. If manually the script is running ok, you can schedule it to run in the crontab every 5 minutes. Edit the crontab with crontab e command. Add the following row:
*/5 * * * * /opt/allot/NXtoMRTG/run.sh > /dev/null

On the Centos MRTG server


1. Create user account on Linux MRTG server that will be used to copy data to Linux server and run script on Linux MRTG server. To add the new user: /usr/sbin/useradd allot To change the password of allot: passwd allot 2. Copy content of Linux MRTG server folder (can be found in the NXtoMRTG.zip folder) to home folder of created account on Linux MRTG server. In this example to /home/allot 3. Change CSVtoMRTG.pl script to executable: chmod +x /home/allot/CSVtoMRTG.pl 4. Create data folder in home folder of created account: mkdir /home/allot/data 5. Create a folder to save the MRTG files: mkdir /var/www/html/allot 6. Share allot mrtg folder with Apache or another existing web server on linux MRTG server by adding the following paragraph to the end of httpd.conf file located under /etc/httpd/conf:
<Directory "/var/www/html/allot"> AllowOverride None Options None Order allow,deny Allow from all </Directory>

7. Verify that all parameters in CSVtoMRTG.pl match the configuration above. In case you changed the folders above, make sure you make the same change in the script.:
# Version 1.5 # ----------------------- Set variables ----------------------------------------#CSV filename (by default Pipe_Top50_5Min.csv) $reportName = "Pipe_Top50_5Min.csv"; #Description of entity that you graphing bandwidth for... $entityName = "Pipe"; #Script HOME folder $home = "/home/allot"; #Data folder to keep data... every report will have file name starting with report name... $data = "$home/data"; #URL to report CSV file only required if report downloaded through URL $reportUrl = "http://IPOFREMOTESERVER/$reportName"; #Location for CSV file $csvFile = "$home/$reportName"; #MRTG WWW (Web shared folder) $mrtg_www = "/var/www/html/allot"; #Name of WWW virtual folder (e.g. your url is http://IP/allot/) $www_root = "allot"; #Path to MRTG bin folder (where mrtg script located... and set env LANG required to run MRTG) $mrtg_scriptPath = "env LANG=C /usr/bin/mrtg"; # if file delivered over HTTP from remote URL (not from local filesystem) uncoment following line # and define URL in $reoprtURL #system ("wget $reportUrl -q -O $csvFile"); # ------------------------ End of Set variables -----------------------------------------

8. Modify the path to the mrtg bin folder in CSVtoMRTG.pl if its not located under /usr/local/mrtg2/bin/mrtg 9. Schedule to run CSVtoMRTG.pl script in Crontab using by adding the following line using the crontab -e command (e.g. taking into consideration script home folder /home/allot/: */5 * * * * /home/allot/CSVtoMRTG.pl > /home/allot/run.log &

You might also like