Tuesday, December 27, 2011

how to check open ports on linux machine?

Use the commands
1) nmap -sS -O 127.0.0.1 or
2) netstat -nap   
   netstat --listen
 To display open ports and established TCP connections, enter:
   netstat -vatn
 To display only open UDP ports try the following command:
  netstat -vaun\
  if you want to see FQDN (full dns hostname), try removing the -n flag:
  netstat -vat

Friday, December 16, 2011

Jenkins most useful features

Jenkins is a CI (Continuous Integration) tool which is used to widely to manage builds and tests. In this blog, I'm listing some of the add on's which makes Jenkins richer and support it's use to manage builds using Jenkins instead of homegrown scripts. Most of these additional functionality comes through Jenkins plugin's.

1) Support to GIT source code management
    Plugin: Jenkins GIT plugin
    It checkout code from GIT repository (using http/ssh/local/git protocol), poll for changes and trigger build

2) Archive the build artifacts (Post build section)
    Provides link for download to artifacts which are built. It acts a one stop dashboard where you build and distribute artifacts to consumers. These artifacts are preserved as long as logs are preserved.
   Plugin: Comes with default Jenkins download

3) Publishing Junit test result on build dashboard (Post build section)
    If your project running junit tests, provide link to xml reports. Jenkins publish the test results , compose historical trends, web UI for viewing/tracking test results.
   Plugin: Comes with default Jenkins download

4) Publishing Javadocs on build dashboard (Post build section)
   If your project generating javadocs (for ex: mvn javadoc:javadoc), provide link to xml reports. Jenkins will publish the latest Javadoc and it can also retain older javadocs if needed.
   Plugin: Comes with default Jenkins download

5) Publishing code coverage metrics ( ex: cobertura )
   If your project calculating code coverage metrics (for ex: mvn cobertura:cobertura), provide link to xml reports generated by your coverage tools like cobertura/clover/Emma. Jenkins will publish the coverage metrics on job dashboard.
     Plugin: Jenkins cobertura plugin
  Cobertura plugin lets you to fine-tune minimum acceptable levels of code coverage.

6) Build trends
   Clicking "trend" for a project displays build time trend, timeline graph (scroll your mouse on graph to see the historical build timings).

Thursday, December 15, 2011

jenkins error: java.io.IOException: Authentication method password not supported by the server at this stage

When I tried to add a node to jenkins/hudson using ssh as launch method, the authentication keeps on failing with the below error.


[12/15/11 13:23:12] [SSH] Opening SSH connection to **.**.***.**:22.
[12/15/11 13:23:12] [SSH] Authenticating as build/******.
java.io.IOException: Password authentication failed.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:319)
at com.trilead.ssh2.Connection.authenticateWithPassword(Connection.java:314)
at hudson.plugins.sshslaves.SSHLauncher.openConnection(SSHLauncher.java:565)
at hudson.plugins.sshslaves.SSHLauncher.launch(SSHLauncher.java:179)
at hudson.slaves.SlaveComputer$1.call(SlaveComputer.java:199)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.io.IOException: Authentication method password not supported by the server at this stage.
at com.trilead.ssh2.auth.AuthenticationManager.authenticatePassword(AuthenticationManager.java:289)
... 9 more
[12/15/11 13:23:12] [SSH] Connection closed.


The host has SLES OS and I was wondering what's going wrong, even though I gave correct password.

FIX: Change the sshd configuration
   In /etc/sshd_config (or /etc/ssh/sshd_config) file
  # To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
If set to no, Hudson's SSH client won't be able to connect using password authentication. If you comment this line out (which I believe is the OpenSSH default), or set it to yes, then Hudson can connect just fine.


Tuesday, December 6, 2011

How to check a machine is physical or VMware virtual machine

Run command
  • dmidecode | grep -i vmware
  • If it is a physical machine, it won't return any data
  • If it is a VMWare Virtual machine, you will get output like
        Manufacturer: VMware, Inc.
        Product Name: VMware Virtual Platform
  • What is dmidecode ?
Dmidecode reports information about your system's hardware as described in your system BIOS according to the SMBIOS/DMI standard. This information typically includes system manufacturer, model name, serial number, BIOS version, asset tag as well as a lot of other details of varying level of interest and reliability depending on the manufacturer. This will often include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of I/O ports (e.g. serial, parallel, USB).
Beware that DMI data have proven to be too unreliable to be blindly trusted. Dmidecode does not scan your hardware, it only reports what the BIOS told it to.

Dmidecode is known to work on the following systems:
  • Linux i386, x86-64, ia64
  • FreeBSD i386, amd64
  • NetBSD i386, amd64
  • OpenBSD i386, amd64
  • BeOS i386
  • Cygwin i386
  • Solaris x86
  • Haiku i586