Python-portal application status check script, python-Portal
This week, a portal application status check script was implemented using python. The main function is to quickly collect application status, automatically collect the status of Preset checkpoints, and improve the problem locating efficiency when exceptions occur. The following functions have been implemented: 1. Process Check 2. GC check 3. PV check in peak seconds 4. TCP Connection check 5. Load check 6. system error Ticket check 7. watchdog status check 8. Storage usage 9. Difficulties in error log Verification: 1. python parses the shell command execution result. To determine whether the result is normal, you need to parse the data into an array or dictionary tip. Summary: 1. parse the shell execution result and return the dictionary object.
12345678910111213141516171819202122232425262728293031 |
# Resolving the title + returning dict objects with multiple rows of data def resolving_shell_table_data_line(ckeys,cvalue): """ ckeys= "mountpoint free used" cvalue = " /dev/sda2 9.0G 5% /dev/sda3 4.5G 4% /dev/sda7 18G 50%" return [ {'mountpoint':'/dev/sda2','free':'9.0G','used':'5%'}, {'mountpoint':'/dev/sda3','free':'4.5G','used':'4%'}, {'mountpoint':'/dev/sda7','free':'18G','used':'50%'}, ] """ keys = [i for i in ckeys.replace( "\n" ," ").split(" ") if i!=" "] res = [] for p in cvalue: p1 = [i for i in p.replace( "\n" ," ").split(" ") if i!=" "] if len (p1)! = len (keys): log( "error data " ) log(cvalue) log(keys) else : res.append( dict ( zip (keys,p1))) return res |
2. convert text to numbers
1 |
string.atof(item[ 'used' ].replace( "%" ,"")) |
Less than 1. The current code reuse rate is not high, reaching 352 rows; 2. Plug-ins are not implemented to add new functions; prospect 1. Optimized to plug-in development methods and defined plug-in specifications, the availability and scalability of the script can be increased;
From Weizhi note (Wiz)
Python script to open the application
1. Open QQ through the path
2. query the registry key = win32api. regOpenKey (win32con. HKEY_CURRENT_USER, 'soft', 0, win32con. KEY_READ) print keyimport osos. startfile ("E: \ QQ \ Bin \ QQ.exe ")
How can I use the python script language to write a window program?
It can be developed using qt or tkinter.
You can also use ironpython + wpf