This was a (very) simple command line utility that I created to parse user input and provide verbiage back to the user for manually creating a support ticket.
Last active
July 14, 2017 01:55
-
-
Save unacceptable/c49b01d0d0c389603f482eecba5dd488 to your computer and use it in GitHub Desktop.
This is just a simple verbiage generation script for CRM.
This file contains hidden or 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/python | |
import sys; | |
import re; | |
####################################### | |
### Main Function ##################### | |
####################################### | |
def main(): | |
read_paste_lump(); | |
ticket_title(); | |
ticket_body(); | |
####################################### | |
### Generic Functions ################# | |
####################################### | |
def separator(userin, character): | |
count=len(userin) | |
print(character*count); | |
print(userin) | |
print(character*count); | |
class tcolor: | |
RED = '\033[38;5;196m' | |
ORANGE = '\033[38;5;208m' | |
YELLOW = '\033[38;5;226m' | |
GREEN = '\033[38;5;46m' | |
BLUE = '\033[38;5;33m' | |
INDIGO = '\033[38;5;20m' | |
VIOLET = '\033[38;5;54m' | |
NORMAL = '\033[0m' | |
####################################### | |
### Program Specific Functions ######## | |
####################################### | |
def read_paste_lump(): | |
server_info = raw_input( | |
tcolor.ORANGE + | |
"Please enter VM name and location separated by a space: " + | |
tcolor.NORMAL | |
); | |
server_info = re.split(r'\t+|\ ', server_info.rstrip('\t|\ ')) | |
global server_name; | |
server_name = ' '.join(server_info[:-1]).strip() | |
global server_loc; | |
server_loc = server_info[-1]; | |
global server_alert; | |
server_alert = raw_input( | |
tcolor.ORANGE + | |
"Please enter the VM alert title (Before this text on this line is fine if copying and pasting): " + | |
tcolor.NORMAL | |
); | |
def ticket_title(): | |
if bool(server_loc): | |
title = 'Monitoring Alert | ' + server_name + ' - ' + server_alert + ' - ' + server_loc | |
separator(title, '-') | |
else: | |
sys.exit("Server Location was set to a NULL value.") | |
def ticket_body(): | |
print( | |
"Hello," +"\n\n" + | |
"Our monitoring system has detected the following alert with one of your Secure Cloud Servers:" + "\n\n" + | |
server_name + ' - ' + server_loc + "\n\n" + | |
server_alert + "\n\n" + | |
"Please be aware that this notification has been sent to you as you may need to take urgent action. " + | |
"If you need us to adjust the thresholds on your monitors or provide any further advice then please do not hesitate to reach out to us. " + | |
"Please respond to this ticket at your earliest convenience." + "\n\n" + | |
"Thank you,\nSupport" | |
) | |
####################################### | |
### Execution ######################### | |
####################################### | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment