Forum Discussion
10 Replies
- Kevin_StewartEmployeeThis is actually pretty straight forward. Take a look at the example BASH script monitor at /config/monitors/sample_monitor. This is an example of taking arguments from the GUI monitor (the node and IP), performing some action, and then reporting back ("up" or nothing). If you don't care about monitoring server nodes in your script, then you can just create a BASH script to do what you want it do. You'll use TMSH to get/set whatever you need from the running configuration and an SFTP client is on the box. If you create your script as a monitor and assign it to a "dummy" pool, the BIG-IP will do the job of scheduling it.
- Dave_MehlbergNimbostratus
All I really want to do is output the data from the tmos command 'show sys performance' to a file, then send that file to a server for parsing and displaying.
I can't seem to find a way to enter tmsh from a bash script and then run the command...
Thank You,
Dave
- hooleylistCirrostratustmsh -q show sys performance
- Dave_MehlbergNimbostratus
Thank you. -just what I'm looking for.
Dave
- Srini_87152Cirrostratus
hi Dave,was this successfull from your side? are you able to get show sys performance to file then send that file to a server for parsing and displaying?
Hi,
recently I had to use SFTP to store a scheduled backup to a remote server via SFTP. The script is continuously executed via cron. Two things to consider: 1. cron settings are not stored in .ucs archive (will not be saved / migrated) 2. known hosts are not stored in .ucs archive (will not be saved / migrated) That´s why an additional script is used to update cron and known hosts (pls let me know, if this is required as well). Regarding the script below: SFTP uses a batch file which is dynamically created each time the script runs. It relies on exporting the own SSH public key to the remote destination. Make sure key based authentication via SSH works for root before running the script.! /bin/bash save current configuration to /shared/backup/ directory ( /shared/backup/ needs to be created in advance ) sftp archive to remote server delete archives older 7 days log archive removal to /var/log/ucsdelete copy script to /shared/autobackup.sh make script executable chmod 775 /shared/autobackup.sh modify cron (crontab -e) to save config i.e. two times per day 5 */12 * * * /shared/autobackup.sh time=`date +%Y%m%d_%H%M` unit=`echo "$HOSTNAME" | awk -F '.' '{print $1}'` tmsh save /sys ucs /shared/backup/autoarchive_${unit}_${time}.ucs cat > /shared/backup/sftpbatch << EOF put /shared/backup/autoarchive_${unit}_${time}.ucs /remote/backup/autoarchive_${unit}_${time}.ucs EOF if sftp -b /shared/backup/sftpbatch root@10.200.200.172 then logger -p local0.notice "0108500:5: Remote config backup success for file /shared/backup/autoarchive_${unit}_${time}.ucs" else logger -p local0.warning "0108500:4: Remote config backup failed for file /shared/backup/autoarchive_${unit}_${time}.ucs" fi find /shared/backup/ -name "autoarchive*" -mtime +7 -ls >> /var/log/ucsdelete find /shared/backup/ -name "autoarchive*" -mtime +7 -ls -exec rm -f {} \;
Thanks, Stephan
- ogozar_275571Nimbostratus
Hello,
Hello, when I generate an automatic backup it shows me this error when I execute the script:
Error, invalid characters in UCS file name. The dash, period, forward-slash, plus sign, and underscore are the only special characters allowed.
What is the problem?
Thank's
- Stanislas_Piro2Cumulonimbus
Hi,
Please provide the backup script you use!
The only answer I can give with provided info is:
The dash, period, forward-slash, plus sign, and underscore are the only special characters allowed.
- ogozar_275571Nimbostratus!/bin/bash
DATE=
echo getHostName=$HOSTNAME tmsh save sys ucs $HOSTNAME$DATE cd /var/local/ucs/ ftp -n 192.168.1.2 <date "+_%d_%m_%y"
The test was run in version 12.1.2 build 0.0.249 and there were no problems. But the tests were performed in a cluster with version 12.0.0 bluid 0.0.606 and showed the error mentioned.
Simplify the script to only: "tmsh save sys ucs backup_test" and showed the same error.
- ogozar_275571Nimbostratus
I was able to determine what the problem was. Thank you.