def callback(result): # callback to analyse the results: this function is called after running # the command on each hos. If the command exited ok we select the average # pingtime from the result and add it to the dataset if result.get_exitcode() == 0: # quick 'n dirty ;-) avg = result.get_stdout()[-1].split(" ")[3].split("/")[1] # add the value we grabbed from the output to the node's result result.add_value("avg", float(avg))
def analyzer(result): # callback to analyse the results: if the command exited ok # we select the average pingtime from the result and add it to the dataset if result.get_exitcode() == 0 and len(result.get_stdout()) > 0: stdout = result.get_stdout() result.add_value('HTTP-code', stdout[0]) i = 1 # first line was the HTTP-code while stdout[i].strip() != "": if ":" in stdout[i]: x = stdout[i].split(': ', 2) result.add_value(x[0].strip(), x[1].strip()) i += 1 try: soup = BeautifulSoup("\n".join(stdout[i:])) result.add_value('title', soup.title.string if soup.title else '<<none>>') except: pass
def analyzer(result): # callback to analyse the results: if the command exited ok # we select the average pingtime from the result and add it to the dataset if result.get_exitcode() == 0: avg = result.get_stdout()[-1].split(" ")[3].split("/")[1] result.add_value("avg", float(avg))