Changeset 108 for hacks/munin
- Timestamp:
- Dec 11, 2017, 1:04:59 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
hacks/munin/fritzboxdect.py
r107 r108 63 63 64 64 65 ## Wheter to display debug messages. 66 g_fDebug = len(os.environ.get('debug', '')) > 0; 67 65 68 66 69 class FritzBoxConnection(object): … … 73 76 74 77 def __init__(self, sServer, sPassword, iPort = 80): 75 self.fDebug = len(os.environ.get('debug', '')) > 0;76 77 78 # 78 79 # Connect to the fritz!box. … … 143 144 sName, sValue = sArg.split('=') 144 145 sUrl += '&' + urllib_quote(sName) + '=' + urllib_quote(sValue); 145 if self.fDebug:146 if g_fDebug: 146 147 print('debug: sUrl: %s' % (sUrl,)); 147 148 … … 161 162 asRet = []; 162 163 asIps = os.environ.get('fritzboxdect_ip', '10.42.2.1 10.42.1.50').split(); 164 if len(asIps) == 0: 165 raise Exception('environment variable fritzboxdect_ip is empty') 163 166 asPasswords = os.environ.get('fritzboxdect_password', '').split(); 167 if len(asPasswords) == 0: 168 raise Exception('environment variable fritzboxdect_password is empty') 169 if g_fDebug: 170 print('debug: asIps=%s asPasswords=%s' % (asIps, asPasswords,)); 171 164 172 for i, sIp in enumerate(asIps): 165 173 sPassword = asPasswords[i] if i < len(asPasswords) else asPasswords[-1];
Note:
See TracChangeset
for help on using the changeset viewer.