Simulating lively Check_MK tcp agent outputs

Trying to write a new check for Check_MK  often has two problems:

  • No live output which would show live traffic flow.
  • No “errors” because the systems normally aren’t broken.

For SNMP-based hosts:

There is a perfect solution named the “Agent Simulator”, just enable agent_simulator in and use {} in the stored output.

You make Check_MK run on stored output using usewalk_hosts += [ “hosttag” ] or by going into simulation_mode = True.

The datafiles are either in var/check_mk/snmpwalks or in tmp/check_mk_cache/

Then the following is possible:

  • Auto-switching states – i.e. 1 1 1 1 1 2 5 would make a network interface that goes down every 6 minutes (how awesome is that)
  • Wave-forms, or plain and simply
  • continuous growth.

For TCP-based hosts:

There is nothing similar. Nobody had the time to build it.

I had to build a check for a host which I don’t have and more severely, I also couldn’t produce real traffic. But I needed to verify it gives me useful data. The solution was to make a little script that replaces my agent output (which is read in using datasource_programs) on the fly.


floh@klappstuhl:~$ cat fudge-counters 
while true ; do 
 sleep 10 
 i=$(( $i + 1 ))
 newwrite=$(( $write + $i * 100000 ))
 newread=$(( $read + $i * 100000 ))
 cat ~/git/abcd/agent_output/aix-perflib | 
 sed "s/$write/$newwrite/" | 
 sed "s/$read/$newread/" > /tmp/customer/aix-perflib

Get the original counter values, replace the file continuosly, but do only change them while it passes by.

That way the original stays intact.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s