TMG:Automatic Text CDR Retrieval
m (add warning) |
(add tbcopycdr source link) |
||
Line 3: | Line 3: | ||
Warning: If the destination is a Windows server, you require to install software that supports scp (i.e. freeSSHd). Not tested by TelcoBridges personnel. | Warning: If the destination is a Windows server, you require to install software that supports scp (i.e. freeSSHd). Not tested by TelcoBridges personnel. | ||
+ | The shell script used by this procedure is included in the [[Tmedia]]'s distribution. For other distribution the tbcopycdr script can be decompressed from the [http://repo.telcobridges.com/centos/5.5/updates/SRPMS/tb_tools-1.1-3.src.rpm tb_tools.src.rpm] SRPM. | ||
= Setup SSH Public/Private Key = | = Setup SSH Public/Private Key = | ||
Line 28: | Line 29: | ||
*Set the following variables in the file | *Set the following variables in the file | ||
**TMG_CDR_DIR (Tmedia directory where the [[Text_Call_Detail_Records_(CDR)|CDR]] are located) | **TMG_CDR_DIR (Tmedia directory where the [[Text_Call_Detail_Records_(CDR)|CDR]] are located) | ||
− | **REMOTE_DIR (Remote host directory where the [[Text_Call_Detail_Records_(CDR)|CDR]] will be send) | + | **REMOTE_DIR (Remote host directory where the [[Text_Call_Detail_Records_(CDR)|CDR]] will be send, the directory MUST exist) |
**REMOTE_USER (Remote host user) | **REMOTE_USER (Remote host user) | ||
**REMOTE_HOST (Remote host name or Ip address) | **REMOTE_HOST (Remote host name or Ip address) |
Revision as of 10:47, 4 February 2011
This procedure shows how to configure a Tmedia to send its CDR files to a remote server automatically.
Warning: If the destination is a Windows server, you require to install software that supports scp (i.e. freeSSHd). Not tested by TelcoBridges personnel.
The shell script used by this procedure is included in the Tmedia's distribution. For other distribution the tbcopycdr script can be decompressed from the tb_tools.src.rpm SRPM.
Contents |
Setup SSH Public/Private Key
This will enable the Tmedia to send files to the remote host without asking for a password:
- Connect to the Tmedia using SSH as root
- Create Tmedia public/private dsa key pair
ssh-keygen -t dsa
Note: Do not add a pass phrase, simply press enter until the key pair is generate.
- Append the content of the public key to the remote host authorized keys
Tmedia public key location
/root/.ssh/id_dsa.pub
Remote Host authorized keys location
~/.ssh/authorized_keys
Configure the Tmedia to Send files
- Open the file configuration
vim /usr/bin/tbcopycdr
- Set the following variables in the file
- TMG_CDR_DIR (Tmedia directory where the CDR are located)
- REMOTE_DIR (Remote host directory where the CDR will be send, the directory MUST exist)
- REMOTE_USER (Remote host user)
- REMOTE_HOST (Remote host name or Ip address)
- ERASE_AFTER_SEND (TMedia will erase the CDR files locally or not after a successful send, default true)
Note: if you set ERASE_AFTER_SEND to false the CDR text file will be available in the /home/telcobridges/cdr/ directory and rename *.gz.already_send.
Example: Send the files to the home directory of the root user of host 10.10.10.10
TMG_CDR_DIR=/lib/tb/toolpack/setup/12358/2.5/apps/gateway/cdr_logs/ REMOTE_DIR=~/ REMOTE_USER=root REMOTE_HOST=10.10.10.10 ERASE_AFTER_SEND=true
Validate Setup Configuration
- Run the tbcopycdr script with the -v option
tbcopycdr -v
If no error were seen on the shell, your configuration is correct. Also, you should have a hello_world.log file on the remote host.
Configure Tmedia to send the files automatically
- Create a new crontab on the Tmedia
crontab -e
- Add new line with the cron configuration
Example:
Frequency | Cron Configuration |
---|---|
Every 10 minutes | */10 * * * * /usr/bin/tbcopycdr
|
hourly (top of the hour) | 0 * * * * /usr/bin/tbcopycdr
|
daily (midnight) | 0 0 * * * /usr/bin/tbcopycdr
|