Backup whole F5 bigIP configuration and save as file - bash

I'm trying to export my current F5 bigIP configuration into a file and later create a replica of the same bigIP with that configuration.
This reference mentioned following this:
Create the UCS archive file by using the following command syntax, replacing with the full path to the UCS archive file:
tmsh save /sys ucs <path/to/UCS>
I logged in to my bigIP, but when trying this, it gives me error. What is the problem? How to fix it?
Syntax Error: "ucs" unexpected argument

You can verify the syntax within the TMSH shell just like on a Cisco. Just enter tmsh and then type save and hit ? from there you can also use tab to complete the command.

This command should save a dated ucs file to your /var/local/ucs directory.
[yourbigip] # tmsh save sys ucs "$(date | tr -d ':' | tr -d )".ucs
You can always find additional help at https://devcentral.f5.com.

Related

Jmeter run test plan from command line with external link to properties

Problem: In debug mode I can run test plan with no issues, but in none-gui got problem while parsing access to file, looks like properties file.
Here are details:
jmeter.logs
2018-08-31 13:26:30,831 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.IllegalArgumentException: File 2 must exist and be readable at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:424) ~[ApacheJMeter_core.jar:4.0 r1823414]
My Test Plan:
enter image description here
External property file contain link to other file with list of users.
enter image description here
Here is my Test Plan and property file reader sampler.
Both files SAT.properties, SAT.users.22315010.csv have full access
-rwxrwx---+ 1 Domain Users 212 Aug 31 12:41 SAT.properties
-rwxrwx---+ 1 Domain Users 123 Aug 30 13:20 SAT.users.22315010.csv
Cmd command used to run script:
jmeter -n -t D:\PW\Automation\Jmeter\Reports\Reports_Random.jmx -Jusers=1 -l D:\PW\Automation\Jmeter\Reports\Results\JResults.jtl
The answer lies in Property File Reader comments, you need to escape your path:
If you want c:\abc , You need to have c:\abc as value in your property file as \ is used for escape sequence in Java
I don't think using this "property file reader" makes sense as the functionality of reading an external properties file is available right out of the box in JMeter.
Instead of using the plugin you can just pass the path to your SAT.properties file using -q command-line argument like:
jmeter -q d:\PW\Automation\JMeter\Reports\Properties\SAT.properties -n -t D:\PW\Automation\Jmeter\Reports\Reports_Random.jmx -Jusers=1 -l D:\PW\Automation\Jmeter\Reports\Results\JResults.jtl
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide

Bash commands putting out extra information which results into issues with scripts

Okay, hopefully I can explain this correctly as I have no idea what's causing this or how to resolve this.
For some reason bash commands (on a CentOS 6.x server) are displaying more information than "normally" and that causes issues with certain scripts. I have no clue if there is a name for this, but hopefully someone knows a solution for this.
First example.
Correct / good server:
[root#goodserver ~]# vzctl enter 3567
entered into CT 3567
[root#example /]#
(this is the correct behaviour)
Incorrect / bad server:
[root#badserver /]# vzctl enter 3127
Entering CT
entered into CT 3127
Open /dev/pts/0
[root#example /]#
With the "bad" server it will display more information as usual, like:
Entering CT
Open /dev/pts/0
It's like it parsing extra information on what it's doing.
Ofcourse the above is purely something cosmetic, however with several bash scripts we use, these issues are really issues.
A part of the script we use, uses the following command (there are more, but this is mainly a example of what's wrong):
DOMAIN=`vzctl exec $VEID 'hostname -d'`
The result of the above information is parsed in /etc/named.conf.
On the GOOD server it would be added in the named.conf like this:
zone "example.com" {
type master;
file "example.com";
allow-transfer {
200.190.100.10;
200.190.101.10;
common-allow-transfer;
};
};
The above is correct.
On the BAD server it would be added in the named.conf like this:
zone "Executing command: hostname -d
example.com" {
type master;
file "Executing command: hostname -d
example.com";
allow-transfer {
200.190.100.10;
200.190.101.10;
common-allow-transfer;
};
};
So it's add stuff of the action it does, in this example "Executing command: hostname -d"
Another example here when I run the command on a good server and on the bad server.
Bad server:
[root#bad-server /]# DOMAIN=`vzctl exec 3333 'hostname -d'`
[root#bad-server /]# echo $DOMAIN
Executing command: hostname -d example.com
Good server:
[root#good-server ~]# DOMAIN=`vzctl exec 4444 'hostname -d'`
[root#good-server ~]# echo $DOMAIN
example.com
My knowledge is limited, but I have tried several things checking rsyslog and the grub.conf, but nothing seems out of the ordinary.
I have no clue why it's displaying the extra information.
Probably it's something simple / stupid, but I have been trying to solve this for hours now and I really have no clue...
So any help is really appreciated.
Added information:
Both servers use: kernel.printk = 7 4 1 7
(I don't know if that's useful)
Well (thanks to Aaron for pointing me in the right direction) I finally found the little culprit which was causing all the issues I experienced with this script (which worked for every other server, so no need to change that obviously).
The issues were caused by the VERBOSE leven set in vz.conf (located in /etc/vz/ directory). There is an option in there called "VERBOSE" and in my case it was set to 3.
According to OpenVZ's website it does the following:
Increments logging level up from the default. Can be used multiple times.
Default value is set to the value of VERBOSE parameter in the global
configuration file vz.conf(5), or to 0 if not set by VERBOSE parameter.
After I changed VERBOSE=3 to VERBOSE=0 my script worked fine once again (as it did for every other server). :-)
So a big shoutout to Aaron for pointing me in the right direction. The answer is easy when you know where to look!
Sorry to say, but I am kinda disappointed by ndim's reaction. This is the 2nd time he was very unhelpful and rude in his response after that. He clearly didn't read the issue I posted correctly. Oh well.
I would make sure to properly parse the output of the command. In this case, we are only interested in lines of the form
entered into CT 12345
One way of doing this would be to pipe everything through sed and having sed print only the number when the line looks as above (untested, and I always forget which braces/brackets/parens need a backslash in front of them):
whateverthecommand | sed -n 's/^entered into CT ([0-9]{1,})$/\1/p'

Consuming function module with SAP Netweaver RFC SDK in Bash

I'm trying to make a request to a function in a SAP RFC server hosted at 10.123.231.123 with user myuser, password mypass, sysnr 00, client 076, language E. The name of the function is My_Function_Nm with params: string Alternative, string Date, string Name.
I use the command line:
/usr/sap/nwrfcsdk/bin/startrfc -h 10.123.231.123 -s 00 -u myuser -p mypass -c 076 -l en -F My_Function_Nm
But it always shows me the help instructions.
I guess I'm not specifying the -E pathname=edifile, and it's because i don't know how to create a EDI File to include the parameters values to the specified function. Maybe someone can help me on how to create this file and how to correctly invoke startrfc to consume from this function?
Thanks in advance.
If you actually check the help text the problem shows, you should find the following passages:
RFC connection options:
[...]
-2 SNA mode on.
You must set this if you want to connect to R/2.
[...]
-3 R/3 mode on.
You must set this if you want to connect to R/3.
Apparently you forgot to specify -3...
You should use sapnwrfc.ini which will store your connection parameters, and it should be places in the same directory as client program.
Sample file for your app should be following:
DEST=TST1
ASHOST=10.123.231.123
USER=myuser
PASSWD=mypass
SYSNR=076
RFC_TRACE=0
Documentation on using this file is here.
For calling the function you must create Bash-script, but better to use Python script.

need to read IP from a text and set manually on centos

i have 10 IP which have been listed on a CSV or text file , i need to read each time one line and get the IP and set on eth0 interface of the server, i found the bellow script which some how show me how to create new network setting but i do not know how i could read one line from CSV and put it on variable to use with bellow script . i would be greatly thankful if you give me some hint , thanks
https://wiki.gogrid.com/index.php/Customer:Automatically_convert_your_Linux_server_to_a_static_IP
May something like this:
#!/bin/sh
lineNumber=1
ip=`head -n $lineNumber test.csv | tail -n 1 | line`
echo $ip

Jmeter - url from command line

I have been trying to pass the url for a web page from the command line to do performance testing using Jmeter.
I had set up the user defined variables like
NumberOfUsers ${__P(NumberOfUsers,2)}
HowManyTimesToRun ${__P(HowManyTimesToRun,2)}
RampUpTime ${__P(RampUpTime, 10)}
Host ${__P(Host)}
I tried using the Jmeter command as
./jmeter.sh -n -t Performance.jmx -l old88.jtl -JNumberOfUsers=5 -JRampUpTime=10JHowManyTimesToRun=2 -JHost=www.google.com
It seems to take all the values correctly except the host name. Is there a way to pass the url from command line. I use this property in HTTP request Defaults.
I do not see any issues here - except a space ' ' and '-' are missing for 'HowManyTimesToRun' property. Maybe it s a typo!!
./jmeter.sh -n -t Performance.jmx -l old88.jtl -JNumberOfUsers=5 -JRampUpTime=10 -JHowManyTimesToRun=2 -JHost=www.google.com

Resources