Changeset 3ece2bd in nscp
- Timestamp:
- 11/08/07 21:54:39 (6 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- e46ad71
- Parents:
- 22d2739
- Files:
-
- 8 edited
-
AutoBuild.h (modified) (1 diff)
-
NSClient++.cpp (modified) (2 diffs)
-
changelog (modified) (1 diff)
-
include/INISettings.h (modified) (1 diff)
-
include/NSCHelper.cpp (modified) (1 diff)
-
include/checkHelpers.hpp (modified) (8 diffs)
-
modules/CheckSystem/CheckSystem.cpp (modified) (1 diff)
-
modules/CheckWMI/CheckWMI.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
AutoBuild.h
r22d2739 r3ece2bd 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,2,7, 446 #define PRODUCTVER 0,2,7,14 27 #define STRFILEVER "0.2.7. 44"8 #define STRPRODUCTVER "0.2.7.14 2"9 #define STRPRODUCTDATE "2007-11-0 6"5 #define FILEVER 0,2,7,51 6 #define PRODUCTVER 0,2,7,149 7 #define STRFILEVER "0.2.7.51" 8 #define STRPRODUCTVER "0.2.7.149" 9 #define STRPRODUCTDATE "2007-11-08" 10 10 #endif // AUTOBUILD_H -
NSClient++.cpp
r22d2739 r3ece2bd 448 448 return; 449 449 } 450 std::string file_stl = file; 451 std::string::size_type pos = file_stl.find_last_of("\\"); 452 if (pos != std::string::npos) 453 file_stl = file_stl.substr(pos); 450 454 { 451 455 ReadLock readLock(&m_mutexRW, true, 5000); … … 479 483 break; 480 484 } 481 std::cout << k << " " << file << "(" << line << ") " << message << std::endl;485 std::cout << k << " " << file_stl << "(" << line << ") " << message << std::endl; 482 486 } 483 487 for (pluginList::size_type i = 0; i< messageHandlers_.size(); i++) { -
changelog
r22d2739 r3ece2bd 4 4 * Fix installer (after configuration UI) 5 5 * Add module for relaying events 6 * Fix WMI module7 * Fix PDH problems8 6 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 7 8 2007-11-08 MickeM 9 + Added CheckWMIValue to check result-values from a WMI Query 10 * Changed so performance values are "collapsed" ie 75362115584 = 70.0G (#89) 11 If anyone dont want this let me know and I will make an option for it. 9 12 10 13 2007-11-06 MickeM -
include/INISettings.h
ra6aaf0a r3ece2bd 172 172 for (std::list<INIFile*>::const_iterator cit = files_.begin(); cit != files_.end(); ++cit) { 173 173 INIFile::sectionList tmp = (*cit)->getSection(section, bufferLength); 174 std::cout << "< <<Reading: " << section << " from: " << (*cit)->getFile() << std::endl;174 std::cout << "< Reading: " << section << " from: " << (*cit)->getFile() << std::endl; 175 175 ret.insert(ret.begin(), tmp.begin(), tmp.end()); 176 176 } -
include/NSCHelper.cpp
r22d2739 r3ece2bd 156 156 if ((msgType == NSCAPI::debug) && (!logDebug())) 157 157 return; 158 /* 158 159 std::string::size_type pos = file.find_last_of("\\"); 159 160 if (pos != std::string::npos) 160 161 file = file.substr(pos); 162 */ 161 163 return fNSAPIMessage(msgType, file.c_str(), line, message.c_str()); 162 164 } -
include/checkHelpers.hpp
rb749b8d r3ece2bd 134 134 return strEx::itos_as_BKMG(value); 135 135 } 136 static std::string print_perf(TType value) { 137 return strEx::itos_as_BKMG(value); 138 } 136 139 static TType parse(std::string s) { 137 140 return strEx::stoi64_as_BKMG(s); … … 184 187 return strEx::itos(value); 185 188 } 189 static std::string print_perf(TType value) { 190 return strEx::itos(value); 191 } 186 192 static std::string key_prefix() { 187 193 return ""; … … 205 211 return strEx::itos(value); 206 212 } 213 static std::string print_perf(int value) { 214 return strEx::itos(value); 215 } 207 216 static std::string print_unformated(int value) { 208 217 return strEx::itos(value); … … 229 238 return strEx::itos(value); 230 239 } 240 static std::string print_perf(__int64 value) { 241 return strEx::itos(value); 242 } 231 243 static std::string print_unformated(__int64 value) { 232 244 return strEx::itos(value); … … 235 247 return strEx::itos(value) + "%"; 236 248 } 249 static std::string key_prefix() { 250 return ""; 251 } 252 static std::string key_postfix() { 253 return ""; 254 } 237 255 }; 238 256 class double_handler { … … 243 261 static double parse_percent(std::string s) { 244 262 return strEx::stod(s); 263 } 264 static std::string print_perf(double value) { 265 return strEx::itos(value); 245 266 } 246 267 static std::string print(double value) { … … 335 356 } 336 357 static std::string gatherPerfData(std::string alias, TType &value, TType warn, TType crit) { 337 return MAKE_PERFDATA(alias, THandler::print_ unformated(value), "", THandler::print_unformated(warn), THandler::print_unformated(crit));358 return MAKE_PERFDATA(alias, THandler::print_perf(value), "", THandler::print_perf(warn), THandler::print_perf(crit)); 338 359 } 339 360 … … 471 492 } else { 472 493 return 473 MAKE_PERFDATA(alias, THandler::print_ unformated(value.value), "",474 THandler::print_ unformated(warn), THandler::print_unformated(crit));494 MAKE_PERFDATA(alias, THandler::print_perf(value.value), "", 495 THandler::print_perf(warn), THandler::print_perf(crit)); 475 496 } 476 497 } -
modules/CheckSystem/CheckSystem.cpp
r478588b r3ece2bd 313 313 return strEx::itos(value); 314 314 } 315 static std::string print_perf(int value) { 316 return strEx::itos(value); 317 } 315 318 static std::string print_percent(int value) { 316 319 return strEx::itos(value) + "%"; -
modules/CheckWMI/CheckWMI.cpp
r22d2739 r3ece2bd 143 143 144 144 NSCAPI::nagiosReturn CheckWMI::CheckSimpleWMIValue(const unsigned int argLen, char **char_args, std::string &message, std::string &perf) { 145 message = "Not yet implemented :("; 146 return NSCAPI::returnCRIT; 145 typedef checkHolders::CheckConatiner<checkHolders::MaxMinBounds<checkHolders::NumericBounds<long long, checkHolders::int64_handler> > > WMIConatiner; 146 std::list<std::string> stl_args = arrayBuffer::arrayBuffer2list(argLen, char_args); 147 if (stl_args.empty()) { 148 message = "ERROR: Missing argument exception."; 149 return NSCAPI::returnUNKNOWN; 150 } 151 std::list<WMIConatiner> list; 152 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 153 WMIConatiner tmpObject; 154 bool bPerfData = true; 155 unsigned int truncate = 0; 156 std::string query; 157 158 // Query=Select ... MaxWarn=5 MaxCrit=12 Check=Col1 --(later)-- Match==test Check=Col2 159 // MaxWarnNumeric:ID=>5 160 try { 161 MAP_OPTIONS_BEGIN(stl_args) 162 MAP_OPTIONS_SHOWALL(tmpObject) 163 MAP_OPTIONS_NUMERIC_ALL(tmpObject, "") 164 MAP_OPTIONS_STR("Alias", tmpObject.data) 165 MAP_OPTIONS_STR("Query", query) 166 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 167 MAP_OPTIONS_STR_AND("Check", tmpObject.data, list.push_back(tmpObject)) 168 MAP_OPTIONS_STR("Alias", tmpObject.data) 169 MAP_OPTIONS_SECONDARY_BEGIN(":", p2) 170 MAP_OPTIONS_SECONDARY_STR_AND(p2,"Check", tmpObject.data, tmpObject.alias, list.push_back(tmpObject)) 171 MAP_OPTIONS_MISSING_EX(p2, message, "Unknown argument: ") 172 MAP_OPTIONS_SECONDARY_END() 173 MAP_OPTIONS_MISSING(message, "Unknown argument: ") 174 MAP_OPTIONS_END() 175 176 } catch (filters::parse_exception e) { 177 message = "WMIQuery failed: " + e.getMessage(); 178 return NSCAPI::returnCRIT; 179 } 180 181 WMIQuery::result_type rows; 182 try { 183 rows = wmiQuery.execute(query); 184 } catch (WMIException e) { 185 message = "WMIQuery failed: " + e.getMessage(); 186 return NSCAPI::returnCRIT; 187 } 188 int hit_count = 0; 189 190 for (std::list<WMIConatiner>::const_iterator it = list.begin(); it != list.end(); ++it) { 191 WMIConatiner itm = (*it); 192 itm.setDefault(tmpObject); 193 itm.perfData = bPerfData; 194 if (itm.data == "*") { 195 for (WMIQuery::result_type::const_iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) { 196 for (WMIQuery::wmi_row::list_type::const_iterator citCol = (*citRow).results.begin(); citCol != (*citRow).results.end(); ++citCol) { 197 long long value = (*citCol).second.numeric; 198 itm.runCheck(value, returnCode, message, perf); 199 } 200 } 201 } else { 202 for (WMIQuery::result_type::const_iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) { 203 bool found = false; 204 for (WMIQuery::wmi_row::list_type::const_iterator citCol = (*citRow).results.begin(); citCol != (*citRow).results.end(); ++citCol) { 205 if ((*citCol).first == itm.data) { 206 found = true; 207 long long value = (*citCol).second.numeric; 208 itm.runCheck(value, returnCode, message, perf); 209 } 210 } 211 if (!found) { 212 NSC_LOG_ERROR_STD("Column: " + itm.data + " was not found!"); 213 } 214 } 215 } 216 } 217 218 if ((truncate > 0) && (message.length() > (truncate-4))) 219 message = message.substr(0, truncate-4) + "..."; 220 if (message.empty()) 221 message = "OK: WMI Query returned no results."; 222 return returnCode; 147 223 } 148 224 … … 168 244 } 169 245 std::vector<int> widths; 170 for (WMIQuery::result_type:: iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) {246 for (WMIQuery::result_type::const_iterator citRow = rows.begin(); citRow != rows.end(); ++citRow) { 171 247 const WMIQuery::wmi_row vals = *citRow; 172 248 if (citRow == rows.begin()) {
Note: See TracChangeset
for help on using the changeset viewer.








