severity_high_y = 50 + header_size_y severity_medium_y = 150 + header_size_y severity_low_y = 250 + header_size_y severity_info_y = 350 + header_size_y im = gd.image((image_width, image_height)) white = im.colorAllocate((255, 255, 255)) black = im.colorAllocate((0, 0, 0)) red = im.colorAllocate((255, 0, 0)) orange = im.colorAllocate((255, 100, 0)) blue = im.colorAllocate((0, 0, 255)) green = im.colorAllocate((0, 255, 0)) client = PreludeEasy.Client("PoolingTest") client.Init() client.PoolInit("192.168.33.215", 1) def gd_init(): FONT = "/usr/share/fonts/truetype/ttf-bitstream-vera/VeraMono.ttf" # Headers im.line((0, header_size_y), (image_width, header_size_y), black) im.string_ttf(FONT, 8, 0, (70, 12), "timeline", black) im.line((200, 0), (200, header_size_y), black) im.string_ttf(FONT, 8, 0, (250, 12), "impact.severity", black) im.line((400, 0), (400, header_size_y), black) im.string_ttf(FONT, 8, 0, (450, 12), "classification.text", black)
import rtg_cli except: print "Cannot import rtg_cli" try: import PreludeEasy except: print "Import failed" print "Try 'cd ./.libs && ln -s libprelude_python.so _PreludeEasy.so'" sys.exit(1) # # GD Constants # client = PreludeEasy.Client("PreludeRTG") client.Init() client.PoolInit("192.168.33.215", 1) # # 10000 could be considered as the maximum, since # it would cover already a big classification.text # def unique_alert_number(ClassificationText): number = 0 for c in ClassificationText: number += ord(c) return number