Checklist When IBM WebSphere Application server is running up - websphere-8

I have an IBM WebSphere Application Server v8.5 (WAS) installed on Linux RedHat 6.
My question: how can I check on the following by command (if exist):
Is the application server running or not?
Is the web application that deployed on it running or not?
The database connectivity (using datasource) is connected successfully or not?

The easiest and quickest to check all these things is to use web administrative console available at http://yourHost:9060/ibm/console.
If you want to use command, then:
Is the application server running or not?
You can check that issuing serverStatus command (will check all servers):
%PROFILE_ROOT%/bin/serverStatus.sh -all
or for specific server:
%PROFILE_ROOT%/bin/serverStatus.sh serverName
the output will be something like:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>serverstatus server1
ADMU0116I: Tool information is being logged in file
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\serverSta
tus.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU0500I: Retrieving server status for server1
ADMU0508I: The Application Server "server1" is STARTED
Is the web application that deployed on it running or not?
There is no direct command for this. You can use wsadmin script for that. A simple one could be like the one below, if it returns entry the application is running:
print AdminControl.completeObjectName('type=Application,name=myApplication,*')
For more details check this question How do I determine if an application is running using wsadmin?
The database connectivity (using datasource) is connected successfully or not?
There is no direct command for this. You can use wsadmin script for that also. Here is sample script:
ds = AdminConfig.getid('/DataSource:Default Datasource/')
AdminControl.testConnection(ds)
For more details check this page Testing data source connections using wsadmin scripting

The serverStatus.sh command is s..l..o..w.. If you want an answer today then there is a file in the logs folder with the process PID:
/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/servername/servername.pid
That file contains the PID of the server process. If it is running:
ps -p pid
Then the server is up.

1. ps -ef | grep dmgr
2. ps -ef | grep <application name>
Also grep SystemOut.log for e-business and verify latest timestamp.
Log into admin console, browse to DataSource, display from all scopes, select your datasource and then click test. As long as the nodeagent is running and has been restarted at least once since the Datasource config and credentials were added, then this test should be fairly accurate.

Related

How to copy files from local to hdfs using oozie

I am trying to copy files from my edge node to HDFS using oozie. Many suggested to setup password less ssh to get this done.
Iam unable to login to oozie user as it is a service user.
Is there any other way other than password less ssh.
Thanks in advance.
Other than password less ssh there are two more options :
1. My preferred option : Use JSch java library and create a java application which will accept a shell script to be executed as argument. Using the JSch , it will perform ssh on the configured edge node and execute the shell script on the edge node. In the jsch, you can configure, the edgenode username and password. Use 'JCEKS' file to store the password.
Then add a Java Action in Oozie to run the java application created using JSch.
2. Use "/usr/bin/expect" library to create a shell script, which will perform ssh on edgenode and then run the configured shell script. More details are here Use expect in bash script to provide password to SSH command

Default user: WSO2 Identity Server with Mariadb

I followed the steps defined in this link and restarted the WSO2 identity server.
When trying to login at https://localhost:9443/carbon using admin/admin credentials, it's giving me login failed message. Before changing the settings for WSO2, it was working with this credentials.
Obviously, that user is not present in MariaDB. Does anyone has any scripts to insert an admin user in WSO2 Maria DB for? I don't know what all tables I need to update in case of adding user manually. Or is there any other default user?
Kindly suggest.
Had the same problem, even switched to mysql community and it didn't fix it.
So with mysql installed I did the following, after MANY tries,
mysql -u root -p
create DATABASE regdb;
exit;
mysql -u root -p regdb < <WSO2_HOME>/dbscripts/mysql5.7.sql
mysql -u root -p regdb < <WSO2_HOME>/dbscripts/identity/mysql-5.7.sql
nohup <WSO2_HOME>/bin/wso2server.h -Dsetup &
If there is someplace to see the DB version, I haven't found it, but this got it all to working form me. So loading keep failing the DB because of some default time functions in the sql.
My $0.02

Docker: unix "who" command doesn't work inside container

I have a Docker image that has one non-root user created named builder.
The application that supposed to run inside the container uses unix who command.
For some reason it returns empty string inside the container:
builder#2dc3831c558b:~$ who
builder#2dc3831c558b:~$
I cannot use whoami because of implementation details.
(I'm using Docker 1.6.2 on Debian Jessie)
EDIT (additional details regarding why I use "who"):
I use the command who with the parameters am i, that is who am i. This suppose to return the user who first made the login. So, for example, sudo who am i returns builder, while sudo whoami returns root.
The command who includes options like -b: time of last system boot.
Since all commands from a container translates into system calls to the kernel, that would not return anything container related, but docker-host related (ie the underlying host).
See also "Difference between who and whoami commands": whoami prints effective username of being ran whoami, which is not the same as who (printing information about users who are currently logged in).
The current workarounds listed in issue 18547 are:
The registry configuration is stored in the client, so something as simple as cat ~/.docker/config.json will give you the answer you're looking for.
docker info | grep Username should give you this information.
But that is not the same as running the command from within a container session. id -u might be closer.
By default, there is no direct loggin when a container is started by the docker daemon.
As Auzias commented, only a direct ssh connection (initiating a login session) would allow who to return anything. But with docker, this is generally not needed since docker exec (for debug purposes) exists (and spare the image maintainer to include ssh unless it is really needed).

Execute command in ubuntu terminal from an aspnet application

I have a command to drop postgresql database:
sudo -u myuser psql -c "drop database my_databse"
How I could execute this sentence from an aspnet website(c#)?
Is it possible to execute without introducing a password?
This app is running in another server:
I have a windows server running aspnet website.
I have an ubuntu server running postgresql database.
drop database my_databse is an SQL command. You can run it directly from nPgSQL. There is no need to run psql, and no point doing so.
If your usual user account doesn't have the access rights for it, you can make a new temporary connection in nPgSQL just for that command. You might find SET SESSION AUTHORIZATION or SET ROLE useful, too.

Error '2035' ('MQRC_NOT_AUTHORIZED') While Connecting to MQ

I am getting this error while connecting to IBM MQ. I know that this is because of privileges, but is there any way just to check the connection with IBM MQ?
Please suggest.
The 2035 suggests that your connection is getting to the QMgr. If you had the wrong channel name, host or port you would get back a 2059. The 2035 means that the connection made it to the listener, found a channel of the name that was requested and attempted a connection.
If you want to test past this point it will be necessary to either authorize the ID that you are using to connect or to put an authorized ID in the MCAUSER attribute of the channel.
For a detailed explanation of how the WMQ security works on client channels, see the WMQ Base Hardening presentation at http://t-rob.net/links.
If you enable authorization messages then the 2035 will show up in the event queue. Then you can look at the message and see what ID was used to connect and what options were used too. The 2035 might be because you asked for set authority on the queue manager or something else you aren't supposed to have. The authorization messages wil show you that.
You can also resolve this By setting mcauser('mqm') .. i was able to overcome 2035 error.
Define channel (channel1) chltype (svrconn) trptype (tcp) mcauser(‘mqm’)
Esp thanx to my SENIOR Bilal Ahmad (PSE)
You have to check the privileges with an MQ administrator.
You can use dspmqaut to check the grant.
Below is the sample to give user poc access to Queue Manager QM1 and Queue LQ1
# check the access right of user POC to QM1
dspmqaut -m QM1 -n LQ1 -t q -p poc
# if you want to give access, you should use
setmqaut -m QM1 -n LQ1 -t q -p poc <access Types>
# eg (put everything - in the real live scenario, choose only what you want to grant) :
setmqaut -m QM1 -n LQ1 -t q -p poc +put +get +browse +inq +set +crt +dlt +chg +dsp +passid +setid +setall +clr
Then dont forget to restart QM1 with
endmqm -i QM1
strmqm QM1
Finally, you should be able to proceed without error 2035.
I have been struggling with this for ages too. Eventually I found this solution. (If you can call turning off authentication a solution.)
I am using version
- IBM Websphere 9.1.0.201807091223
From IBM's website they advise turning connection authentication off!!!
Resolving the problem Disable channel authentication
You will need to disable connection authentication, at least
temporarily. There are known issues in FTM for Check with regard to
using MQ connection authorization. These problems are actively being
addressed and fixes will appear in a future fix pack. The target is
fixpack 3.0.0.8.
Steps to disable connection authentication: Open MQ command console
and type runmqsc ALTER
AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS)
CHCKCLNT(NONE) CHCKLOCL(NONE) Restart the queue manager for this
change to take effect.
Source http://www-01.ibm.com/support/docview.wss?uid=swg21962081
On this topic if you are using MQSeries 9.1 in a test or development environment you can disable channel authentication with the following approach :
. Launch MQ command line utility with the following :
runmqsc (for example runmqsc QM1)
. Disable authentication for all channels with the following command
ALTER QMGR CHLAUTH (DISABLED)
For a Q/Q-manager running on Windows, you may have to create the user on the Q/Q-manager machine [i.e. create a user on the Q-machine to match the user on the Q-client machine], and then add that user to the 'mqm' group on that machine.
Steps:
Ensure that the domain user that is being used to create the Q CLIENT [i.e. the user that the Q-client app is running under] also exists on the box with the Q/Q-manager. You may be able to just create a local user on the Q/Q-manager box [, or you may have to do some more complicated creation of an Active Directory user - I can't help you there].
On the Q/Q-manager box, add the user you have just created [or the existing one, if it already exists] to the mqm group. [On a Windows server box you will need to use the Microsoft Management Console (1. 'mmc' from the command line, 2. File > Add/Remove SnapOn > Local Users & Groups, 3. add user to group)]. The 'mqm' group should already exist on the Q/Q-manager machine.
Error MQRC 2035 basically means that your application has been able to connect to the queue manager, however due to certain absence of permissions/authorizations, it was unable to put/get/publish/subscribe messages.
To resolve this, at first, try these steps in order to disable the authorizations from queue manager and channel. Use this only if it isn't a production queue manager.
Always check the queue manager logs. It tells you exactly where you need to look into, and resolve the issue.
In this case, generally, you can issue the following commands after doing a runmqsc on the queue manager :
ALTER QMGR CHLAUTH(DISABLED)
Then set the chckclnt object(under authinfo) to optional
DISPLAY QMGR CONNAUTH
DISPLAY AUTHINFO(name-from-above) ALL //name from the first commands
ALTER AUTHINFO(name-from-above) AUTHTYPE(IDPWOS) ADOPTCTX(YES)
ALTER AUTHINFO(name-from-above) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL)
REFRESH SECURITY TYPE(CONNAUTH)
SET CHLAUTH('*') TYPE(BLOCKUSER) ACTION(REMOVEALL)
This helps remove any blocks that the channel is creating against any user.
SET CHLAUTH(your channel name) TYPE(ADDRESSMAP) ADDRESS('*') USERSRC(CHANNEL)
This should resolve your issue, since we have disabled every authorization that an application has to pass in order to do anything on a queue manager.
Now, in case you are using a production queue manager, NEVER remove authorizations.
Go, and right click on any QM that you have configured in your MQ explorer. Go to the QM authority, and authority records. Click on create new user, and give the same name as the username your application is using. Select all the checkboxes, then copy from the space below all the commands that are given. Namely, setmqaut. Edit with your queue manager name, and issue them!
----Never give up, the answer is where you have not looked yet--------

Resources