HammerPing - command /usr/bin/hammer ping

The hammer ping parser reads the output of hammer ping and turns it into a dictionary. The key is the service name, and the value is a dict of all the service info.

Sample output of hammer ping:

candlepin:
    Status:          FAIL
    Server Response: Message: 404 Resource Not Found
elasticsearch:
    Status:          ok
    Server Response: Duration: 35ms
foreman_tasks:
    Status:          ok
    Server Response: Duration: 1ms

Examples

>>> hammer = shared[HammerPing]
>>> 'unknown_service' in hammer.service_list
False
>>> hammer['candlepin']['Status']
'FAIL'
>>> hammer['candlepin']['Server Response']
'Message: 404 Resource Not Found'
>>> hammer.are_all_ok
False
>>> hammer.services_of_status('OK')
['elasticsearch', 'foreman_tasks']
class insights.parsers.hammer_ping.HammerPing(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, dict

Read the hammer ping status and convert it to dictionaries of status and response information.

errors

Any error messages encountered during parsing

Type

list

raw_content

The original output of hammer ping

Type

list

property are_all_ok

Return boolean value to indicate if all the service are running normally

parse_content(content)[source]

This method must be implemented by classes based on this class.

property service_list

Return a list of service in order

services_of_status(status='ok')[source]

List of the services in the given status.

Parameters

status (str) -- the status code to search for, defaulting to ‘ok’. The value is converted to lower case.

Returns: List of service names having that status.