The 3 Laws of Consulting

Lessons from my first 10 years of consulting in IT

Introduction

Immanuel Kant, the German philosopher, said that “experience teaches nothing without theory, but theory without experience is mere intellectual play”.

So after 10 years experience of consulting I finally feel I have enough experience to consider the theory behind what I have been doing and learn the lessons it has taught me and try to draw some real world lessons from the theoretical framework I might have been subconsciously applying.

There are many books about consulting, but most assume you are either a management consultant looking to inspire organisational change, or are an independent contractor looking to maximise revenue and sell your skills. However each of these genres have lessons to teach.

One of the best or at least most accessible theoretical frameworks I found was Gerald Weinburgers “secrets of consulting” which presents his three laws:

  • There’s always a problem
  • It’s always a people problem 
  • Never forget they’re paying you by the hour.

These seem simplistic and not a little cynical, but when you think carefully about them there is surprising depth to each.

1. There is always a problem.

This is probably the most obvious but also the most fundamental rule. There is always a problem, after all, a customer is spending a substantial amount of time and money to have a consultant come in and work with them, if there wasn’t an issue of some sort that they thought a consultant could solve they would spend it elsewhere. No problem, no consultancy needed.

The most obvious IT consulting problem is to install and configure a piece of software, or maybe even to write it from scratch. The customer has decided they need some functionality, and they need it enough to pay for a consultant to make sure it is set up correctly, according to best practices. 

At the other end of the scale is the consulting engagement born out of chaos and disaster, sometimes fixing breakages, fighting fires, sometimes trying to drag their systems and practices kicking and screaming into the 21st century.

Many stages exist between these two extremes but there is always something they need, a problem to be solved, that they cannot provide themselves.

1.1 Stating the problem

In any well organised consulting engagement there should be a scope of works agreed upon between the consultant and the customer. This makes up part of the contractual agreement between the two, a legal agreement that should stand up in court if required.

The scope of works (or SOW) provides the description for all the problems the consultant should solve, work outside of the SOW can prove a major issue to a successful engagement, as it always eats into the time allowed.  It can also open the consultant and their employer up to legal issues, an uncompleted contract and even the coverage of liability insurance, which is often based upon the contract, are both potentially highly costly legal rabbit holes that no one should ever want to venture down.

In any engagement the predefined statement of the problem contained in the scope of works should provide the happy path, and venturing from it should be attempted only with great caution and the agreement of the customer.

1.2 The problem they hire you for, the problem they think they have, and the problem they really need you to solve

Just because a customer states they have a problem, gets budget to fix it, spends a lot of time discussing with salespeople about, writes and agrees a scope of work, and then commits time and effort to help a consultant solve it, does not mean that is the problem they actually have.

This strange fact is much more common than you might expect and the reasons are many and varied.   The chief amongst them is that they have made massive assumptions about both the problem and the solution.  This follows the standard pattern described in the sitcom ‘Yes Minister’ as politicians logic: cats have 4 legs, my dog has 4 legs, therefore my dog is a cat, or in the fad driven world of IT, we need something new, this is new, therefore we need it. The reality is often that there are better approaches to take.

Alternatively the solution may fix the problem, but the problem is really only a symptom of a deeper, more fundamental issue that they either have not understood or are unwilling to face. Patching up ancient software or hardware will fix the immediate failures, but upgrading to modern equipment will fix the problem.

In both these cases a consultant might feel the need to break away from the scope of works, to have a conversation about “why are you doing this, that looks like it might be more appropriate”. Just be prepared to back away if the response is negative. There may be much more going on then you can see. 

Changing the scope of the engagement is really negotiating a new (albeit often informal) scope of works. This needs agreement from both the customer and those who helped scope the project (the sales team and project manager at a minimum), explaining the risks and costs, and being very clear that spending time on this will mean that time cant be spent on the stated problem. Its best to get this agreement in writing, so later, when the discussion is forgotten you can still explain why the original scope of works has not been completed.

1.3 But it doesn’t do that…

Sometimes this seeming duplicity isn’t the customers fault, the sales team have misunderstood the problem or the product and sold them a sub optimal solution. Sometimes the customer knows full well what the problem really is but wants to paper over the cracks because maybe it was their fault or admitting the real issue would lead to a loss of face.

With miss-selling by the consultants own company this can be a major ethical question, do you  plough on or do call out the issue. The best starting point is always to talk to the sales team and find out why it has happened, and agree with them the approach to take. Without a unified approach, the consultant will antagonise both sides, whereas a united front at least gives you friend to fall back on.

When it is the customer deliberately doing the wrong thing it calls for the greatest amount of tact and diplomacy, and to be honest, it may not be worth even having the conversation. If they are really set on making a mistake, then it’s time to invoke the third law (they’re paying you by the hour) and accept it’s their money to waste, it’s not fun but you get paid either way.

1.4 The end of the affair 

In the end, if there really isn’t a problem, or you can no longer see it, it’s time to leave. When you stop learning new things, it’s time to move on.

It’s often tempting to stay on, the job is comfortable and the customer a known quantity, but at some point you stop providing value over and above a permanent employee or general contractor, and they stop providing you with interesting and relevant challenges that meet your interests and career aspirations.

2. There is always a people problem (and sometimes it’s you) 

While most consultants are engaged to deal with a technical problem, if that was all a good consultant needed then they would be ten a penny.  In fact the biggest maker and breaker of consulting engagements comes from dealing with people and personalities, and there is always a people problem.

Consulting engagements always grow out of either a lack of skills, or a lack of manpower at the customer end. If they could do the work themselves they wouldn’t pay someone else, and so any consulting engagement requires an implicit admission of weakness on their part, and this leads to a plethora of potential issues that will come up to bite the unwary consultant.

2.1 Unknown unknowns.

Because the customer lacks the skills to do the work themselves, they also lack the knowledge of the resources a consultant will need to do the work. A consultant might be the greatest expert in their field but only the customer knows their environment, so guidance is needed to help navigate those waters, integrating with the customer environment, setting things up, investigating and changing processes, and a thousand and one other tasks.

The customer knows none of this and so the consultant needs to expend significant time and effort in to tracking down the right people, getting time with them, and explaining exactly what is required and why. There is a delicate art in persuading someone who is busy with work assigned to them by their manager to drop everything and deal with a consultant who is often doing something that will make no difference to them at all.

In this there is a huge amount of scope for delays creep in causing a time crunch as deadlines approach. This requires diplomacy, charm, persistence, and sometimes the application of a metaphorical hammer to deal with. Knowing when to use the hammer, and when to use charm is a core skill for any consultant.

2.3 People personality problems

The real people problems are less benign however.  It is almost impossible to bring a consultant into a company without treading on someone’s toes, and so there’s a whole set of problem people that may hold antagonism toward the consultant.

2.3.1 Technical responses

Amongst technical people a very common source of issues are those who think (or know) they have the skills needed to do the job but feel they have been unfairly overlooked by a management who don’t understand their abilities.

This can manifest in two ways, the positive response comes from those who want to learn what secret sauce the consultant is bringing and look to learn new things, they will often want to sit and watch, to discuss over lunch, and ask for walkthroughs. This can be annoying when there is work to be done, but it’s also a behaviour that means there is a strong chance of the solution continuing to survive and be used beyond the consultants tenure.

The other common reaction is to feel threatened, as if the consultants presence is an insult to their abilities, and might lead to them being replaced. These people will try to undermine the project, either by going slow and doing the minimum necessary to help. They may also attempt to show the consultant up in public and undermine faith in them with public questions designed to catch them out requiring very detailed technical knowledge that is only tangentially related to the matter at hand, and so prove they are better at their job then any newcomer.

With disruptive and obstructive people sometimes it’s easier to let them have their small victory and move on, giving them the security they need to provide you with help down the road.  This takes a suppression of the consultant’s ego, but it’s not personal.

2.3.2 Management responses

Managers fall into two camps, there are those who were involved in bringing the consultant in and are supportive and want a successful engagement to prove to their peers they have made a good decision.  This can boil over into unrealistic expectations, thinking because the consultant is an expert in the field they therefore know everything and can perform any task in 15 seconds flat at the drop of a hat, and will therefore produce months worth of value for weeks worth of cost.

The second camp are those who are hostile, rarely openly so, being seen to oppose a successful project reflects badly on them, but often they think the money could have been better spent following their proposed solution to the problem and by growing their empire and prestige.

2.4 Honesty

Both management and technical resistance is best dealt with early, the longer it goes on the more it festers and grows.  A number of strategies exist for this but by far the easiest is simply to be honest about what you are there to do, and what you are not there to do, and to set expectations at a level that are good but not stellar.  Nobody likes to think of themselves as bad at their job, and a consultant who promises super human (to them) results is promising to show them up to their peers and management.

A good consultant needs to be seen to be worthy of the money they are paying, but being 10% better than average is good, 100% is frightening.

Expectations set on the first day of the engagement are easy to exceed later, in small gradual steps, at each stage giving them time to get used to the new level. As the old adage says boiling a frog is best done by slowly raising the temperature.

3. Never forget they’re paying (for) you by the hour (day/week)

It is tempting to think about this law as simply saying that they are paying you by the hour so the slower you can perform a task the more hours it takes and so the more you earn. Customers are not stupid (although it is often tempting to think otherwise), and they are very wise to this trick, they know when they are spending money and getting little or no value for it, and will not renew an engagement they see as a money pit.

A slightly less obvious but wiser reading is, they are paying you by the hour, which makes you different from their employees, so different things are expected from a consultant.

3.1 Limits and boundaries to work

The difference between an employee and a consultant is that an employee does whatever is needed, and a consultant does whatever is paid for. That is to say an employee will have a contract that says something like “and other tasks as required” and a consultant has a contract which has a clearly defined and limited scope of works that they need to complete in the agreed and defined number of days (hours, months) stated.  An employee can undertake many tasks at once, and push out the completion date, the consultant does not have this luxury and must be focused on the deadline. 

To achieve this the consultant must always keep their eyes on the goal of completing the scope of works. Accepting extra tasks, however interesting, useful, or related to the work in hand they might be, is a major risk to that goal. As a rule of thumb anything that can be dealt with by a 10 minute conversation or email should be, and anything that would require longer than that should be met with a polite refusal or suggestion that it will be dealt with after the main project has been completed.  Occasionally the extra tasks are worth it and the risk can be managed, but failing to complete the scope of works is failing at the engagement no matter how many other tasks have been achieved.

When deadlines approach, and work begins to crunch there is a strong temptation to work longer and longer hours. For short stretches this can be an unfortunate necessity but attempts to sustain it over longer periods inevitably lead to consultant burnout and failure. A project that requires constant long days is a project that is badly scoped, and a customer that is getting much more for their money than they should expect. If you are doing 16 hour days then the customer should be paying for double the amount of time, or the project scope should be half what it is. It is not the consultants role to sacrifice themselves performing impossible tasks.

3.2 Confidence is the greatest weapon

Companies hire consultants to perform some task they cannot perform themselves, that means they expect the consultant to be an expert in whatever subject they need them to be. Sadly this is almost impossible, consultants are not superheroes. They do have special expertise though that provides the next best thing, the confidence and self assured attitude that convinces the customer that they are in safe hands and everything is going to be OK and it will all turn out fine in the end.

Of course beneath the surface absolute panic and terror might be brewing but the calm exterior that the world sees is what makes the reputation.

This can be as simple as how you phrase your comments. 

“I don’t know” is a bad answer, “it’s probably X but let me just check” builds confidence that you are knowledgeable but cautious. 

“I need to follow the documentation” is bad, “let’s follow the docs because missing a step will cause pain later” tells them you’ve been there before and are bringing lessons learnt to their benefit.

With careful phrasing and a willingness to work competence can be faked. It’s common for a consultant to have a lot of background knowledge but only be a page ahead of the customer in actual technical knowledge. It may require serious skills in diplomatic bluff to pull this off, but when it works the results is the adrenaline rush of a job well done and a customer that is none the wiser

3.3 They are not your friends

In the end the relationship between the consultant and their customer is a professional one, and while building a good friendly open relationship will oil the wheels and make the engagement much easier, they are paying for you by the hour.

No one wants to be told how terrible they are, even when they know all of the flaws in their organisation having them pointed out by the hired help is a blow to their ego. This is especially true for managers whose responsibility is to fix the flaws. The easiest way to deal with this ego bursting is to get rid of it by firing the consultant, and this is clearly a bad thing.  This goes for all conversations on site, even when you think you are in private. When you are on a customer site you should always assume they can hear you and treat them respectfully and professionally. The results of an unguarded comment are too great to risk.

A classic case of this is the “I bet you’ve never been to a customer as messed up as us” where “I think you’re all incompetent idiots” is clearly the wrong response, “no you’re pretty bad” may not use quite the same words, but incompetence is still implied. A much more diplomatic (and often more truthful) response might be “everywhere does some things well and some things badly” which subtly says “you’re smart enough to know there are issues but also smart enough to have fixed some already”

Conclusion

The three laws of consulting are flippant, and deliberately so, losing your sense of humour is the surest way to let consulting drag you down, but beneath the humour they do provide a framework for what to expect and how to approach the engagement to maximise the chances of success.


They boil down to:

  • The problem you’re there to solve
  • The people you have to deal with
  • You, and your relationship with the customer.

Or even further reduced, there are three aspects of consulting:

  • The Problem
  • The People
  • The Consultant

Which, for the less humourous and more mathematically minded can be summarised as:

problem + people + consultant = engagement

It is certainly possible to have a successful engagement while ignoring one or sometimes even two of this triumvirate, but that requires knocking the others out of the park, and that is a much harder proposition leaving little room for problems. The strategy that all consultants in whatever field should go into a customer aiming for is to balance. The three and the three laws of consulting provide a good starting point.

A trip into dbus-send

DBus is the interprocess communication mechanism used by the plumbing layer of Linux to allow the various components to use each others services without each of them needing to implement custom code for every other component. Even for a sysadmin its a fairly esoteric subject but it does help explain how another bit of linux works. However I’ve always found exploring it confusing and I tend to forget the hard won lessons soon afterwards. This tim eI decided to post my notes to the internet in the hope that next time I feel the need to explore the world of dbus I have a place to start.

Firstly there are two buses, a session bus that is individual to the users session and used heavily by gnome and other user software, and the system bus used by the plumbing layer.

Each bus has a number of services registered on it that can be listed with the dbus-send command by querying the DBus service itself.

dbus-send --system --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames

which produces an array of the services:††

   array [
      string "org.freedesktop.DBus"
    ...
      string "com.redhat.NewPrinterNotification"
      string "com.redhat.PrinterDriversInstaller"
      string "com.redhat.ifcfgrh1"
      string "fi.w1.wpa_supplicant1"
      string "org.fedoraproject.FirewallD1"
      string "org.freedesktop.Accounts"
      string "org.freedesktop.Avahi"
      string "org.freedesktop.ColorManager"
      string "org.freedesktop.ModemManager1"
      string "org.freedesktop.NetworkManager"
      string "org.freedesktop.PolicyKit1"
      string "org.freedesktop.RealtimeKit1"
      string "org.freedesktop.resolve1"
      string "org.freedesktop.systemd1"
      string "org.gnome.DisplayManager"
   ]

Each service implements at least one object, which has a number of interfaces, which are groups of methods and properties. Lots of different objects can implement the same interface, and so implement the same set of methods and properties this makes it easy to treat them all in a similar way. Two interfaces pretty much everything implements are the org.freedesktop.DBus.Introspectable interface which has a single method “Introspect” that returns a list of all the interfaces, methods, and properties the object implements. The other common interface is org.freedesktop.DBus.Properties which provides common methods to get and set all the properties of the object.

A dbus send command to invoke one of these methods looks like

dbus-send --system --print-reply --dest=[service] [objectname] [interface].[method] [parameters]

so a call to the org.freedesktop.systemd1 service listed in the output above needs the name of an object, but all services implement an object named similar to their service name except with / replacing dots giving /org/freedesktop/systemd1 and as discussed above all objects implement the org.freedesktop.DBus.Introspectable interface with its Introspect method, so we can call:

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1   org.freedesktop.DBus.Introspectable.Introspect

Which lists all the methods and properties available for systemd in an xml format, e.g.:

<interface name="org.freedesktop.systemd1.Manager"&gt;
  <method name="ClearJobs"&gt;
  </method&gt;
  <method name="ResetFailed"&gt;
  </method&gt;
  <method name="ListUnits"&gt;
   <arg type="a(ssssssouso)" direction="out"/&gt;
  </method&gt;
  <method name="ListUnitsFiltered"&gt;
   <arg type="as" direction="in"/&gt;
   <arg type="a(ssssssouso)" direction="out"/&gt;
  </method&gt;
        ...
</interface&gt;

If you’ve followed along so far it should then come as no surprise that you can run the ListUnits method and get a list of all the units managed by systemd:

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1   org.freedesktop.systemd1.Manager.ListUnits 
...
      struct {            
         string "ypbind.service"                                                                                       
         string "ypbind.service"                                                                                       
         string "not-found"                                                                                            
         string "inactive"
         string "dead"                                  
         string ""                                                                                                     
         object path "/org/freedesktop/systemd1/unit/ypbind_2eservice"                                                 
         uint32 0         
         string ""                                                                                                     
         object path "/"                                                                                               
      }         

(the 2e in the path is the ascii code for a period. the question of why I have ypbind installed on my laptop is for another day, but at least its not running)

This tells us that ypbind has its own object on the bus called /org/freedesktop/systemd1/unit/ypbind_2eservice, and indeed

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/ypbind_2eservice  org.freedesktop.DBus.Introspectable.Introspect

Lists its methods and properties because it too implements the org.freedesktop.DBus.Introspectable interface. The –dest option is still set to org.freedesktop.systemd1 because ybbind_2eservice is a child object of systemd1. But why was this not listed when we introspected the org.freedsktop.DBus object?

Objects within a service form a hierarchy, and introspecting any object will only list the direct child objects that belong to it. org.freedesktop.DBus has no child objects of its own and the ListNames method we used initially lists the top level services register on the bus, not all the objects they provide. So how then do we seek out these child objects?

When you introspect an object it not only lists the methods and properties of the object, but it also lists the names of the child objects or nodes that sit directly below it. We can see these by introspecting again:

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1   org.freedesktop.DBus.Introspectable.Introspect  | grep node
<node&gt;
 <node name="unit"/&gt;
 <node name="job"/&gt;
</node&gt;

We can then introspect these in turn

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit   org.freedesktop.DBus.Introspectable.Introspect  | grep node
...
 <node name="rpcbind_2eservice"/&gt;                                                                                                                                                                                                             
 <node name="iscsi_2eservice"/&gt;                                                                                                                                                                                                               
 <node name="rpc_2dstatd_2eservice"/&gt;        
 <node name="ypbind_2eservice"/&gt;

and as these are children of /org/freedesktop/systemd1/unit that gives us the /org/freedesktop/systemd1/unit/ypbind_2eservice object we saw above.

While listing objects is fun we really want to be able to send then messages over the bus, or in other words call their methods.

Pretty much every object on the bus implements the org.freedesktop.DBus.Properties.Get interface that provides methods to set and get parameters. In the introspection output above there were methods described like:

 <interface name="org.freedesktop.DBus.Properties"&gt;                                                                    
  <method name="Get"&gt;                                                                                                  
   <arg name="interface" direction="in" type="s"/&gt;                                                                     
   <arg name="property" direction="in" type="s"/&gt;                                                                      
   <arg name="value" direction="out" type="v"/&gt;                                                                        
  </method&gt;                                                                                                            
  <method name="GetAll"&gt;                                                                                               
   <arg name="interface" direction="in" type="s"/&gt;                                                                     
   <arg name="properties" direction="out" type="a{sv}"/&gt;                                                               
  </method&gt;                                                                                                            
  <method name="Set"&gt;                                                                                                  
   <arg name="interface" direction="in" type="s"/&gt;                                                                     
   <arg name="property" direction="in" type="s"/&gt;                                                                      
   <arg name="value" direction="in" type="v"/&gt;                                                                         
  </method&gt; 
...
 <interface name="org.freedesktop.systemd1.Service"&gt;
  <property name="MainPID" type="u" access="read"&gt;
  </property&gt;

Arguments with direction “in” obviously need to be passed in and those with direction “out” are the return values. Each parameter needs to have its data type appended to its value, and they are passed on the dbus-send command line in the order specified. So to get the value of the MainPID property we need to pass the interface and the property name, both strings (s):

# dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/docker_2dcontainerd_2eservice org.freedesktop.DBus.Properties.Get string:org.freedesktop.systemd1.Service string:MainPID

method return time=1561025611.053851 sender=:1.5 -> destination=:1.28678 serial=39522 reply_serial=2
   variant       uint32 22193

and we get back a variant (type=v), in this case the pid of the docker containerd process

# ps -ef | grep 22193

root     22193     1  0 10:02 ?        00:00:00 /usr/libexec/docker/docker-containerd-current --listen unix:///run/containerd.sock --shim /usr/libexec/docker/docker-containerd-shim-current --start-timeout 2m

Other methods let us start and stop the unit

  <method name="Start"&gt;
   <arg type="s" direction="in"/&gt;
   <arg type="o" direction="out"/&gt;
  </method&gt;
  <method name="Restart"&gt;                                                                                              
   <arg type="s" direction="in"/&gt;                                                                                      
   <arg type="o" direction="out"/&gt;                                                                                     
  </method&gt;

These parameters have no names given but a bit of trial and reading of error messages suggests that in “in” parameter is job-mode, described in the systemctl man page as controling “how to deal with already queued jobs”, with “replace” as a valid option. So we can restart the service simply by:

dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/docker_2dcontainerd_2eservice  org.freedesktop.systemd1.Unit.Restart string:replace

And we can now inspect the PID of the process again:

# dbus-send --system --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/docker_2dcontainerd_2eservice org.freedesktop.DBus.Properties.Get string:org.freedesktop.systemd1.Service string:MainPID

method return time=1561069031.851603 sender=:1.5 -> destination=:1.34460 serial=47532 reply_serial=2
   variant       uint32 31169

The process number is now reporting as 31169, and when we double check:

# ps -ef | grep 31169
root     31169     1  0 23:14 ?        00:00:00 /usr/libexec/docker/docker-containerd-current --listen unix:///run/containerd.sock --shim /usr/libexec/docker/docker-containerd-shim-current --start-timeout 2m

And we can see the pid of the docker service has changed after it was restarted.

And there we have it, how to explore and manipulate the system via dbus.

One final bonus, systemd can also be used to control the power state of the machine, is this the most verbose reboot command possible?

dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1/unit/reboot_2etarget org.freedesktop.systemd1.Unit.Start string:replace-irreversibly