How To Easily Audit Your Servers With JumpCloud

By Rajat Bhargava Posted June 10, 2014

Have you ever been asked to quickly audit your servers? Maybe how many are there, what operating systems, applications? Software licenses? Processors, memory? Or maybe you need to do a quick audit of who actually has privileged access to your servers? We have been hearing this task as a critical one for admins a lot lately, especially with our friends in the hosting industry where they need to regularly audit the number of licenses of Red Hat Linux or Windows or SQL server. So we wanted to extend on our command execution functionality and current knowledge base.

Why is auditing servers a pain?

The challenge with auditing servers today is that you can quickly write a script to go grab the requisite information from one of your servers. Or maybe even in a handful. But, how do you do that regularly with hundreds, thousands or even tens of thousands of servers like larger organizations have? You could try to write more code to be able to traverse the network or perhaps even run it regularly. Maybe you can hook it up to an NMAP scanner that will find the devices and then try to audit them. But, then that presumes you have credentials to access each of those servers. Any way you slice it, canvassing your servers for information quickly and easily is not a layup.

How Server Orchestration can help you audit your servers

As we have been talking to more customers and partners, this is an important use case for our command execution functionality. JumpCloud’s “architecture” makes the task of auditing your servers for any number of variables incredibly quick and easy. Our command execution functionality by design has access to each server (through an agent that you install on each server or distribute through Chef / Puppet / AMIs or the like) and can execute commands or scripts on each server: Windows or Linux. You simply script what you are looking for and then execute that script across your server base. All results are brought back to you and any failures are also reported. And, if you need to regularly audit your servers, just setup a scheduled task in our interface.

Let’s actually walk through a few examples with the steps that you’ll need to follow to execute your audit.

For all of these tasks, let’s assume that you would like to run them across your entire server infrastructure. Let’s also assume that you have already placed the JumpCloud agent on all of your servers. If you haven’t done that, this Installation with Configuration Management Tools knowledge base article will help you quickly and easily distribute your agents out to all of your servers. Here are the steps that you would follow:

  1. Login to the JumpCloud console
  2. Go into the Commands tab on the left hand navigation.
  3. Click on “Create Command” at the top of the “Saved Commands” table.
  4. Select whether the command is for Linux or Windows at the top of the window.
  5. Type a name for your command, such as “Audit hardware”
  6. Select the user to run as: this can be root or any JumpCloud-managed user.
  7. Select the set of servers to run the command against, either server-by-server, or via the tag.
  8. Then, cut and paste one of the commands below (make sure you’re pasting a Linux command if you select Linux in step 4, same for Windows).
  9. Click “Save & Run Now”

And, now we’ll go through examples for the specific tasks to run your audits.

Example #1: Audit your servers for who has privileged access

Linux

awk -F’:’ ‘{ if ($2 != “*”) print }’ /etc/shadow

Windows

Get-WmiObject -Class Win32_UserAccount

Example #2: Audit your servers for any Windows operating systems

(Get-WmiObject Win32_OperatingSystem).Name;

(Get-WmiObject Win32_OperatingSystem).OSArchitecture;

(Get-WmiObject Win32_OperatingSystem).CSName;

Example #3: Audit your servers for processor, memory, and disk capacity

Linux

df

cat /proc/cpuinfo

cat /proc/meminfo

Windows

get-WmiObject Win32_ComputerSystem

get-WmiObject Win32_LogicalDisk

Example #4: Audit your servers for current load

Linux

cat /proc/loadavg

Windows

Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average

After you’ve run your commands, let’s focus in on how you want to process your results. All results are available in the Commands tab, in the Command Results section (lower part of the screen).

That’s it, it’s that simple. You can take a process that normally takes hours and turn it into one that takes minutes. Welcome to JumpCloud!

If you would like to learn more about JumpCloud’s Directory-as-a-Service® platform, drop us a note, or feel free to give it a try. Your first 10 users are free forever.

Rajat Bhargava

Rajat Bhargava is co-founder and CEO of JumpCloud, the first Directory-as-a-Service (DaaS). JumpCloud securely connects and manages employees, their devices and IT applications. An MIT graduate with two decades of experience in industries including cloud, security, networking and IT, Rajat is an eight-time entrepreneur with five exits including two IPOs, three trade sales and three companies still private.

Recent Posts