I want to create a monitoring shell script which checks the status of jboss machines. but the problem is my jboss machines are on a different port(ssh) and unix on telnet.
ssh can be run against ports different than their standard port numbers, 23 & 22 respectively. For instance
telnet hostname 8080 will connect you, using telnet protocol, to the port 8080 of hostname you specify. Similar is possible for ssh as well. E.g.
ssh -p 8080 hostname command do the same using ssh protocol.
Since I don't know what type of check you are doing for jboss, it is hard to give you an advice on that.