This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Nagios monitoring script for moosefs master server | |
# Based on mfscgiserv from moosefs author | |
# hungnv 13022012 | |
import socket | |
import struct | |
import sys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# The Bash shell script executes a command with a time-out. | |
# Upon time-out expiration SIGTERM (15) is sent to the process. If the signal | |
# is blocked, then the subsequent SIGKILL (9) terminates it. | |
# | |
# Based on the Bash documentation example. | |
# Hello Chet, | |
# please find attached a "little easier" :-) to comprehend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# hungnv | |
import csv | |
L0 = [ x[0] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L1 = [ x[1] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L2 = [ x[2] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
L3 = [ x[3] for x in csv.reader(open('ZS_SOURCE.csv','r')) ] | |
#FL = [] | |
for i in xrange(len(L1)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def heart_check(target): | |
global last_check | |
if int(time() - last_check) > 5: | |
logger(ctime() + ": Perform heart check") | |
p = re.compile("[a-z0-9-.]*?\.[a-z0-9]+$") | |
domain_tld = p.findall(target)[0] | |
conn = HTTPConnection(domain_tld, timeout = 5) | |
try: | |
accepted_responses = (404, 302, 304, 301, 200) | |
conn.request('HEAD', '/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
- sequence read | |
- sequence write | |
""" | |
import os | |
import sys | |
import time | |
import errno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
- sequence read | |
- sequence write | |
""" | |
import os | |
import sys | |
import time | |
import errno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export QTWEBKIT_PLUGIN_PATH=/usr/lib/browser-plugins:/usr/lib/flash-plugin:/usr/lib/mozilla/plugin:/usr/lib64/flash-plugin:/usr/lib64/mozilla/plugins:/usr/lib64/opera/plugins; export LIBXCB_ALLOW_SLOPPY_LOCK=1;xvfb-run --server-args="-screen 0, 1280x800x24" phantomjs --load-plugins=yes ambientscreenshot.js http://google.com /data/imgs/google.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cacti> | |
<hash_020016b09df6b35e243cb959f0fac2a1de48f2> | |
<name>Memcached Server - Multiport</name> | |
<graph_templates>hash_000016ddd8df13eea701e8e0515081995fcfd8|hash_0000169298c486308a406a19d77e68e367fd53|hash_000016540aaa04728046da9eb5fc3b17931aee|hash_0000168fc8202d6b446dfa6b9cab4ab8b6ff84|hash_0000166ea53ffa66406a3d46fcbb4cb85ce5ae|hash_000016fddba8d561e012a395cbf909deb4d1da</graph_templates> | |
<data_queries></data_queries> | |
</hash_020016b09df6b35e243cb959f0fac2a1de48f2> | |
<hash_000016ddd8df13eea701e8e0515081995fcfd8> | |
<name>Memcached - Bytes Used - Multiport</name> | |
<graph> | |
<t_title>on</t_title> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void process(String topic, ConsumerConnector consumer) { | |
Map<String, Integer> topicCountMap = new HashMap<>(); | |
topicCountMap.put(topic, new Integer(1)); | |
Map<String, List<KafkaStream<byte[], byte[]>>> consumerMap = consumer.createMessageStreams(topicCountMap); | |
KafkaStream<byte[], byte[]> stream = consumerMap.get(topic).get(0); | |
ConsumerIterator<byte[], byte[]> it = stream.iterator(); | |
while (it.hasNext()) { | |
try { |
OlderNewer