Jenkins does not set all properties for Siebel gateway server - shell

We are currently using Siebel 15.14.
I am trying to start our gateway server by creating a job in Jenkins that executes a script. In turn, the script runs a "set up environment properties" script and the command that start the gateway server.
All these happen over an SSH build step in Jenkins.
Specifically:
1) Jenkins job has 1 build step "execute shell script on remote server using ssh": /mypath/start_gateway.sh
2) start.gateway.sh contains:
i) . /mygatewaypath/setupparameters.sh
ii) /mygatewaypath/gtwysrvr/bin/start_ns -r /mygatewaypath/gtwysrvr
3) setupparameters.sh contains:
if [ ! -d "$HOME" ]; then
echo "ERROR: HOME must be set prior to starting the Siebel server!"
exit 1
fi
SIEBEL_ROOT=/mygatewatpath/gtwysrvr ; export SIEBEL_ROOT
SIEBEL_HOME=/mygatewatpath/gtwysrvr ; export SIEBEL_HOME
.
. (other variables go here)
.
Although the jenkins job has a successful build and prints out:
executing script:
/var/SP/administration/scripts/start_gateway.sh
started at Mon Sep 18 18:53:48 2017, pid: 147189
[SSH] exit-status: 0
Finished: SUCCESS
When i try to start the gateway server manager i receive the below error:
Fatal error (2555922): Could not open connection to Siebel Gateway configuration store (%1:%2)., exiting...
Also, if i start the application server (which is based on the above gateway server) , the application server is not started correctly.
It Seems that the environments variables of the setupproperties.sh script are not set fully, so the gateway server start in an unstable state.

try to look at the gateway log file in:
/pathtoyourgateway/log/NameSrvr.log
You should get the error.

Related

Connect to Jenkins server via SSH

I was wondering if I can ssh a local instance of Jenkins. When I go to Jenkins CLI menu in the UI, there's a comment saying the below:
You can access various features in Jenkins through a command-line
tool. See the documentation for more details of this feature. To get
started, download jenkins-cli.jar, and run it as follows:
java -jar jenkins-cli.jar -s http://localhost:8080/ -webSocket help
So I tried it and it worked but it only gave a list of limited commands which I can execute. So I searched more and found I can use -ssh instead of -webSocket but I get the same result as -webSocket.
What I want to do is accessing the Jenkins bash so I can test my build scripts.
I'm trying
ssh 127.0.0.1 -p 23 // I set this port in the settings
but I keep getting :
shell request failed on channel 0
is it impossible what I'm trying to do? if not, how can I achieve it?

vsts build Agent Shell provide password

I'm currently creating a build agent for our DevOps.
With the agent I want to stop solr via shell script on the unix server. The problem is, I need to insert a password, to stop the service.
Is there a simple way to provide the password in the shell script? The current script:
service solr stop
throws the following error:
2020-03-12T12:50:27.0480993Z Successfully connected.
2020-03-12T12:50:27.0483958Z service solr stop
2020-03-12T12:50:29.7903365Z
2020-03-12T12:50:29.8193011Z ##[error]Failed to stop solr.service: Interactive authentication required.
2020-03-12T12:50:29.8208401Z
2020-03-12T12:50:29.8208979Z
2020-03-12T12:50:29.8209589Z ##[error]See system logs and 'systemctl status solr.service' for details.
2020-03-12T12:50:29.8209971Z
2020-03-12T12:50:29.8210587Z ##[error]Command failed with errors on remote machine.
2020-03-12T12:50:29.8341862Z ##[section]Finishing: stop solr
I also tried to provide the password on the script, like:
echo <password> | sudo -S service solr stop
It works on the server locally, but the buildserver throws:
2020-03-12T12:52:17.9543478Z Successfully connected.
2020-03-12T12:52:17.9545108Z echo *** | sudo -S service solr stop
2020-03-12T12:52:18.9946984Z ##[error][sudo] password for ***:
2020-03-12T12:52:23.4808034Z ##[error]Command failed with errors on remote machine.
2020-03-12T12:52:23.5019910Z ##[section]Finishing: stop solr
Any other ideas how I could remotely stop solr with a shell script?
As mentioned I found a solution and posted it in another post. Here's the answer link: https://stackoverflow.com/a/60666738/5835745

How to deploy Apache-Jmeter-5.1.1 on Pivotal Cloud Foundary

I am trying to deploy an Apache-Jmeter (version 5.1.1), a stand-alone application on Pivotal cloud Foundry but unable to
I have the Apache-Jmeter (version 5.1.1) set-up running on my windows machine so I tried to push that directory/folder to PCF as an App but it failed with the below error
C:\Program Files\apache-jmeter-5.1.1>cf push apache-jmeter-5.1.1
Pushing from manifest to org dev-testing/ space Dev as user1...
Using manifest file C:\Program Files\apache-jmeter-5.1.1\manifest.yml
Getting app info...
readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset
FAILED
Here is my manifest.yml file looks like :
---
applications:
- name: jmeter-5-1-pcf
path: bin/jmeter.bat
memory: 512m
instances: 1
I should be able to run my Jmeter scripts (I mean test.jmx) from Pivotal Cloud Foundry, also It could be good if I can see the UI of Apache-Jmeter which was deployed on Pivotal Cloud Foundry
OK, easy answer first.
readat C:\Program Files\apache-jmeter-5.1.1\bin\jmeter.bat: negative offset
FAILED
It's failing because that's a Windows bat file, and you're trying to run it on Linux. You would want to run the .sh start script, and make sure you're pushing the .tgz download from the JMeter Binaries page.
Beyond that, it gets murky and depends on what exactly you want to run?
You could simply run jmeter from the command line, like here. In that case, you don't have a persistent running server though, which poses a problem because Cloud Foundry expects your app to run forever.
You could work around this by using a task instead. You would need to push JMeter as an app, let it stage then stop the app. After that you could cf run-task to execute jmeter -n -t plan.jmx ....
The other option would be to try and run JMeter remote, but that's not going to work well because JMeter uses Java RMI, which is not HTTP based so it would require use of Cloud Foundry TCP routes, or copious use of cf ssh to make tunnels. Neither are great options.
I would suggest using the cf cli. A quick test, the following worked for me.
Download the .tgz binary release from JMeter's web site.
Add the following .cfignore file. It just skips stuff you don't need.
NOTICE
LICENSE
README.md
docs
printable_docs
licenses
extras
Add a file .profile. This will set a couple env variables to make JMeter work.
export JAVA_HOME=.java-buildpack/open_jdk_jre/
export PATH=$PATH:$JAVA_HOME/bin
Put your .jmx files into the JMeter directory.
Then run cf push -b java_buildpack -m 1G -c 'sleep 9999' -u process --no-route jmeter-cli.
The app should start and do nothing, immediately run cf stop jmeter-cli. You just need to do this so that the app stages.
Then run cf run-task jmeter-cli './bin/jmeter -n -t your-test.jmx'.
Run cf logs --recent jmeter-cli and see the results. Or run cf logs jmeter-cli in a second terminal and stream them as the task runs.
Example output:
2019-09-08T22:06:35.72-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed creating container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
2019-09-08T22:06:36.56-0400 [CELL/0] OUT Cell e5f61515-c164-4c36-9686-faa2a0a363ed successfully created container for instance 29a1deb6-04c1-4105-91f8-0a8a5dadf367
2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR Sep 09, 2019 2:06:41 AM java.util.prefs.FileSystemPreferences$1 run
2019-09-08T22:06:41.18-0400 [APP/TASK/4e6e54e6/0] ERR INFO: Created user preferences directory.
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Creating summariser <summary>
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Created the tree successfully using Test Google.jmx
2019-09-08T22:06:41.61-0400 [APP/TASK/4e6e54e6/0] OUT Starting the test # Mon Sep 09 02:06:41 UTC 2019 (1567994801615)
2019-09-08T22:06:41.63-0400 [APP/TASK/4e6e54e6/0] OUT Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4445
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT summary = 30 in 00:00:02 = 19.9/s Avg: 99 Min: 60 Max: 450 Err: 0 (0.00%)
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT Tidying up ... # Mon Sep 09 02:06:43 UTC 2019 (1567994803664)
2019-09-08T22:06:43.66-0400 [APP/TASK/4e6e54e6/0] OUT ... end of run
2019-09-08T22:06:44.39-0400 [APP/TASK/4e6e54e6/0] OUT Exit status 0
The only other thing to mention is that you can use the -l option and write the output to a JTL file. If you do that, it will write to the local file system and when your task ends that file will disappear, you won't be able to get it.
If you need to write the results to a JTL file, then you will also need to modify the task command that you run to, upon completion of JMeter, upload the results file to persistent storage like S3.
Hope that helps!

How to run jmeter test through remote servers via jenkins

I am having a linux machine (say m1) [an openStack machine] to run my jmeter test.
My typical process was to put latest jmx file on this machine and trigger below command:
nohup /path/to/jmeter/bin/jmeter -n -t /path/to/script/test.jmx -l /path/to/resultsFolder/results.jtl
Now, I want to trigger same test via jenkins job which should actually do the same activity as above.
I perform two activities (one is to manually trigger jmeter-server on m1 and other to run jenkins job to run test via m1)
To start jmeter server
Ran following command manually on m1 ( SERVER_PORT=1099 nohup /path/to/jmeter/bin/jmeter-server)
Jenkins Job
I have created a jenkins pipeline job:
Stage1: checks out jmeter in jenkins master
stage2: checks out latest script in jenkins master
stage3: Runs jmeter remote test -
command used :
sh '''
chmod u+x jmeter/bin/jmeter.sh
jmeter/bin/jmeter.sh -n -t path/where/jenkins/checked/latest/test/test.jmx -R 10.X.X.X -l results.jtl'''
Stage1 and stage2 runs perfectly.
Stage3: console output shows as below
jmeter/bin/jmeter.sh -n -t jmeter/bin/jmeter.sh -n -t path/where/jenkins/checked/latest/test/test.jmx -R 10.X.X.X -l results.jtl
Creating summariser
Created the tree successfully using path/where/jenkins/checked/latest/test/test.jmx
Configuring remote engine: 10.X.X.X
Starting remote engines
Starting the test # Tue Aug 14 10:41:46 CEST 2018 (1534236106818)
Remote engines have been started
Waiting for possible shutdown message on port 4445
And it keep showing processing ......... unless I trigger manual shutdown.
So, I'm looking for two things
a mechanism to start jmeter-server on slave nodes via jenkins job itself
Running test via remote machines (which can go locations within load machine and trigger test from there itslef)
. Any ideas appreciated. Thank you in advance!
You can launch jmeter server on remote slaves in at least 2 ways:
From Jenkins using Jenkins SSH Plugin
From JMeter itself using OS Process Sampler or SSH Command plugin (in this case you will have 2 scripts, one which will set everything up and another will be the main test in distributed mode.

Exception when publishing, exception message [Exec timed out or was interrupted after .. ms]

I need to create a Jenkins job that runs a PowerShell script on another server over SSH.
I am using 'Send files or execute commands over SSH' option to do the needful. The 'Exec command' field has value "cmd /c XCopy.bat" where XCopy.bat (batch file present on the other server - Windows server 2008 R2 - where my SSH is installed) in turns runs the PowerShell. The job is simply to copy a folder and its content to another location.
When I build the job, the copying is done as desired. However, the job terminates in Unstable build. Here are the logs:
SSH: Connecting from host [USVAUJNKW001]
SSH: Connecting with configuration [54.254.146.206-SGSGDAPPW001] ...
SSH: EXEC: STDOUT/STDERR from command [cmd /c XCopy.bat] ...
**copy job done**
SSH: Disconnecting configuration [54.254.146.206-SGSGDAPPW001] ...
ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 120,012 ms]
Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
Finished: UNSTABLE
I have tried different 'Exec timeout (ms)' values and (un)checked 'Exec in pty' but to no success.
Queries:
Is there any other option in Jenkins through which I can accomplish the task i.e. to simply run a PS script on another server via SSH.
How could I be using the current option incorrectly?
Do I need to make changes, if any, at batch/PS file level to return some code that tells the Jenkins that job is complete and it should exit successfully?
I have tried to find answers on different forums but none has been exactly useful.
This issue can be resolved by changing the Job configuration.
When using Send Files or execute commands over SSH
Click on Advanced Tab.
Set Execution Timeout(ms): 0
This will help you in avoiding the timeout exception. It has worked for me, so hopefully it will work for you too.
Increase the timeout of SSH server configured in Manage Jenkins settings. Also the exec timeout in job configuration.
relate to Jenkins Text-finder unable to success my Build
Into your job's configure page
Roll down and In Post Steps SSH Publishers
In Transfers Set, click advanced
checked Exec in pty
rojo's suggestion of redirecting output worked for me. I appended this to my script:
>> /var/log/[project-name].log 2>&1

Resources