-1

I've been given the task to create an excel table which includes all Linux servers in one of our AWS EC2 environments because the main aim is to get all the servers off AWS and migrate them to our Virtual environment. These are the row titles of interest: server name, role, CPU, memory, disks, applications components and their versions.

I have no problem extracting server name and server specification, but what is the best way to find what are the server roles? I have a few ideas in my mind but I would love to hear yours... here are mine:

  1. Running rpm -qa --queryformat "%{NAME}\n" to extract all package names to a list which can help me understand what the server does.
  2. Running chkconfig --list |grep on to see which daemons are enabled.
  3. Running top to see which processes are running.
1
  • 5
    There really isn't a proper technical solution to this. You should ask the people who ordered the instance what their use of it is.
    – user9517
    Jul 9, 2014 at 8:33

2 Answers 2

3

There are a few things you could do to try and ascertain what's running on your system. While it's not guaranteed, it is very likely that any production services running will have been made available, either on the local subnet only or via NAT, to the network. With this in mind you can check what ports your server is listening on to get an idea of what's on there. A good command to use would be:

alex:~/ $ sudo netstat -tulpn

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      945/smbd        
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1746/nginx      
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1437/dnsmasq    
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1310/sshd       
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      3746/cupsd  

As you can see from the example output above, it presents you with the protocol version (tcp or udp), the address that's being listened on, the port that's open and the program that's listening.

In the above truncated example (a desktop machine) you can see tcp ports 139, 80, 53, 22 and 631 are listening. These resolve to samba, http, dns, ssh and ipp respectively, and is confirmed when you check the program that's listening on that port.

Additionally, most Debian and Red Hat based Linux Distributions use system V and have the services command available. You can use this to provide a list of services and their states:

alex:~/ $ sudo service --status-all

 [ + ]  acpid
 [ - ]  anacron
 [ + ]  apparmor
 [ ? ]  apport
 [ ? ]  atieventsd
 [ + ]  avahi-daemon
 [ ? ]  binfmt-support
 [ + ]  bluetooth
 [ - ]  brltty
 [ ? ]  console-setup
 [ + ]  cron
 [ ? ]  cryptdisks
 [ ? ]  cryptdisks-early
 [ + ]  cups
 [ + ]  cups-browsed
 [ - ]  dbus
 [ ? ]  dns-clean
 [ + ]  dnsmasq
 [ + ]  ebtables
 [ + ]  friendly-recovery
 [ - ]  grub-common
 [ ? ]  irqbalance
 [ + ]  kerneloops
 [ ? ]  killprocs
 [ ? ]  kmod
 [ + ]  libvirt-bin
 [ ? ]  lightdm
 [ ? ]  networking
 [ + ]  nginx
 [ + ]  nmbd
 [ ? ]  ondemand
 [ + ]  openvpn
 [ ? ]  pppd-dns
 [ - ]  procps
 [ - ]  pulseaudio
 [ ? ]  rc.local
 [ + ]  resolvconf
 [ - ]  rsync
 [ + ]  rsyslog
 [ + ]  samba
 [ - ]  samba-ad-dc
 [ + ]  saned
 [ ? ]  sendsigs
 [ - ]  smartmontools
 [ + ]  smbd
 [ ? ]  speech-dispatcher
 [ - ]  ssh
 [ - ]  sudo
 [ + ]  udev
 [ ? ]  umountfs
 [ ? ]  umountnfs.sh
 [ ? ]  umountroot
 [ - ]  unattended-upgrades
 [ - ]  urandom
 [ ? ]  vboxautostart-service
 [ + ]  vboxballoonctrl-service
 [ + ]  vboxdrv
 [ + ]  vboxweb-service
 [ + ]  winbind
 [ - ]  x11-common

This gives you an overview of system v services - if you have custom applications that are started manually or have custom startup scripts they may not be here, but this is still useful. A + indicates a running service, a - indicates a stopped service and a ? means unknown. Be sure to run both of the above commands as an elevated user, otherwise your results will be incomplete.

The above commands will give you insight in to what's running on your server, but not how it's configured or it's purpose. An open port 80 indicates a web server, but that could mean public facing, internally presented API, httpd installed by accident, any such config. Ideally you need to discuss with the architects to get a better idea of each server's purpose.

6

You need to clarify what 'role' means.

If you see a database running on a server, you could just put 'DB server', but what is its function in your organisation? It is indeed a database server, but is it 'cat picture repository'? 'Customer database'? 'List of primary targets'?

Unless 'role' means simply the main application running on the server, you'll need to understand its position in your organisation to give a reasonable answer.

3
  • 5
    +1 from me. Function is more of a business concept than a technical one, and to get a useful answer to this you'll usually have to talk directly to the stakeholders. If there was an easy way of answering questions like that, the spreadsheet would already exist.
    – MadHatter
    Jul 9, 2014 at 8:00
  • I meant role as in the main applications running on the server.
    – Itai Ganot
    Jul 9, 2014 at 8:08
  • 4
    The main application still requires understanding the business, what inspecting the installed software tells you, e.g. Linux, Apache, MySQL and a handful of PHP does not equate to understanding "this is the main online booking system where we derive 80% revenue from" and not "just another LAMP server".
    – HBruijn
    Jul 9, 2014 at 10:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .