Changeset 7b51081 in nscp for trunk/modules/CheckSystem
- Timestamp:
- 02/23/07 19:25:23 (6 years ago)
- Children:
- 3c35ad4
- Parents:
- 858709e
- Location:
- trunk/modules/CheckSystem
- Files:
-
- 2 edited
-
CheckSystem.cpp (modified) (20 diffs)
-
PDHCollector.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/CheckSystem/CheckSystem.cpp
r858709e r7b51081 10 10 #include <checkHelpers.hpp> 11 11 #include <map> 12 #include <set> 12 13 #include <sysinfo.h> 13 14 … … 309 310 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 310 311 bool bNSClient = false; 312 bool bPerfData = true; 311 313 CPULoadConatiner tmpObject; 312 314 … … 317 319 MAP_OPTIONS_STR("warn", tmpObject.warn.max) 318 320 MAP_OPTIONS_STR("crit", tmpObject.crit.max) 321 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 319 322 MAP_OPTIONS_STR_AND("time", tmpObject.data, list.push_back(tmpObject)) 320 323 MAP_OPTIONS_STR_AND("Time", tmpObject.data, list.push_back(tmpObject)) … … 349 352 } else { 350 353 load.setDefault(tmpObject); 354 if (!bPerfData) 355 load.perfData = false; 351 356 load.runCheck(value, returnCode, msg, perf); 352 357 } … … 371 376 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 372 377 bool bNSClient = false; 378 bool bPerfData = true; 373 379 UpTimeConatiner bounds; 374 380 … … 379 385 MAP_OPTIONS_STR("warn", bounds.warn.min) 380 386 MAP_OPTIONS_STR("crit", bounds.crit.min) 387 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 381 388 MAP_OPTIONS_STR("Alias", bounds.data) 382 389 MAP_OPTIONS_SHOWALL(bounds) … … 396 403 } else { 397 404 value *= 1000; 405 if (!bPerfData) 406 bounds.perfData = false; 398 407 bounds.runCheck(value, returnCode, msg, perf); 399 408 } … … 441 450 } 442 451 std::list<StateConatiner> list; 452 std::set<std::string> excludeList; 443 453 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 444 454 bool bNSClient = false; 445 455 StateConatiner tmpObject; 446 447 tmpObject.data = "uptime"; 448 tmpObject.warn.state = "started"; 449 456 bool bPerfData = true; 457 bool bAutoStart = false; 458 459 tmpObject.data = "service"; 460 tmpObject.crit.state = "started"; 461 //{{ 450 462 MAP_OPTIONS_BEGIN(stl_args) 451 463 MAP_OPTIONS_SHOWALL(tmpObject) 452 464 MAP_OPTIONS_STR("Alias", tmpObject.data) 465 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 453 466 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 467 MAP_OPTIONS_BOOL_TRUE("CheckAll", bAutoStart) 468 MAP_OPTIONS_INSERT("exclude", excludeList) 454 469 MAP_OPTIONS_SECONDARY_BEGIN(":", p2) 455 else if (p2.first == "Time") {456 tmpObject.data = p__.second;457 tmpObject.alias = p2.second;458 list.push_back(tmpObject);459 }460 470 MAP_OPTIONS_MISSING_EX(p2, msg, "Unknown argument: ") 461 471 MAP_OPTIONS_SECONDARY_END() … … 469 479 } 470 480 MAP_OPTIONS_END() 471 481 //}} 482 if (bAutoStart) { 483 // get a list of all service with startup type Automatic 484 std::list<TNtServiceInfo> service_list_automatic; 485 TNtServiceInfo::EnumServices(SERVICE_WIN32,SERVICE_INACTIVE|SERVICE_ACTIVE,&service_list_automatic); 486 for (std::list<TNtServiceInfo>::const_iterator service =service_list_automatic.begin();service!=service_list_automatic.end();++service) { 487 if (excludeList.find((*service).m_strServiceName) == excludeList.end()) { 488 if((*service).m_dwStartType == 2 ) { 489 tmpObject.data = (*service).m_strServiceName; 490 tmpObject.crit.state = "started"; 491 list.push_back(tmpObject); 492 //stl_forward.push_back((*service).m_strServiceName); 493 } 494 else if((*service).m_dwStartType == 4 ) { 495 tmpObject.data = (*service).m_strServiceName; 496 tmpObject.crit.state = "stopped"; 497 list.push_back(tmpObject); 498 } 499 } 500 } 501 } 472 502 for (std::list<StateConatiner>::iterator it = list.begin(); it != list.end(); ++it) { 473 503 TNtServiceInfo info; … … 509 539 else 510 540 value = checkHolders::state_none; 541 if (!bPerfData) 542 (*it).perfData = false; 511 543 (*it).runCheck(value, returnCode, msg, perf); 512 544 } … … 542 574 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 543 575 bool bShowAll = false; 576 bool bPerfData = true; 544 577 bool bNSClient = false; 545 578 MemoryConatiner bounds; … … 551 584 MAP_OPTIONS_STR("Alias", bounds.data) 552 585 MAP_OPTIONS_SHOWALL(bounds) 586 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 553 587 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 554 588 MAP_OPTIONS_MODE("type", "paged", type, tPaged) … … 603 637 return NSCAPI::returnOK; 604 638 } else { 639 if (!bPerfData) 640 bounds.perfData = false; 605 641 bounds.runCheck(value, returnCode, msg, perf); 606 642 } … … 668 704 bool bNSClient = false; 669 705 StateConatiner tmpObject; 706 bool bPerfData = true; 670 707 671 708 tmpObject.data = "uptime"; … … 676 713 MAP_OPTIONS_STR("Alias", tmpObject.alias) 677 714 MAP_OPTIONS_SHOWALL(tmpObject) 715 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 678 716 MAP_OPTIONS_BOOL_TRUE(NSCLIENT, bNSClient) 679 717 MAP_OPTIONS_SECONDARY_BEGIN(":", p2) … … 713 751 if (bFound && (*it).showAll()) { 714 752 if (!msg.empty()) msg += " - "; 715 msg += (*it).data + ": Started";753 msg += (*it).data + ": Running"; 716 754 } else if (bFound) { 717 755 } else { 718 756 if (!msg.empty()) msg += " - "; 719 msg += (*it).data + ": Stopped";757 msg += (*it).data + ": not running"; 720 758 NSCHelper::escalteReturnCodeToCRIT(returnCode); 721 759 } … … 729 767 value.state = checkHolders::state_stopped; 730 768 } 769 if (!bPerfData) 770 (*it).perfData = false; 731 771 (*it).runCheck(value, returnCode, msg, perf); 732 772 } … … 765 805 NSCAPI::nagiosReturn returnCode = NSCAPI::returnOK; 766 806 bool bNSClient = false; 807 bool bPerfData = true; 767 808 /* average maax */ 768 809 bool bCheckAverages = true; … … 776 817 MAP_OPTIONS_STR("MaxCrit", tmpObject.crit.max) 777 818 MAP_OPTIONS_STR("MinCrit", tmpObject.crit.min) 819 MAP_OPTIONS_BOOL_FALSE(IGNORE_PERFDATA, bPerfData) 778 820 MAP_OPTIONS_STR("Alias", tmpObject.data) 779 821 MAP_OPTIONS_SHOWALL(tmpObject) … … 815 857 msg += strEx::itos(value); 816 858 } else { 859 if (!bPerfData) 860 counter.perfData = false; 817 861 counter.setDefault(tmpObject); 818 862 counter.runCheck(value, returnCode, msg, perf); -
trunk/modules/CheckSystem/PDHCollector.cpp
r858709e r7b51081 45 45 * @author mickem 46 46 * 47 * @date 03-13-2004 47 * @date 03-13-2004 48 48 * 49 49 * @bug If we have "custom named" counters ?
Note: See TracChangeset
for help on using the changeset viewer.








