Changeset bb8b6d1 in nscp
- Timestamp:
- 09/19/08 06:48:41 (5 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- c09c225
- Parents:
- 371df23
- Files:
-
- 7 edited
-
NSC.dist (modified) (1 diff)
-
changelog (modified) (1 diff)
-
include/EnumNtSrv.cpp (modified) (1 diff)
-
include/EnumNtSrv.h (modified) (1 diff)
-
include/checkHelpers.hpp (modified) (3 diffs)
-
include/config.h (modified) (1 diff)
-
modules/CheckSystem/CheckSystem.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
NSC.dist
ra34b229 rbb8b6d1 192 192 ;alias_service=checkServiceState CheckAll 193 193 ;alias_mem=checkMem MaxWarn=80% MaxCrit=90% ShowAll type=physical 194 ;alias_event_log=CheckEventLog file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d filter-severity==success filter-severity==informational truncate=1023 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" 195 194 196 195 197 -
changelog
r371df23 rbb8b6d1 4 4 * Add API for rehashing the daemon (or implement it the API is there but does nothing) 5 5 * Improved socket performance (would be nice if we could be used as a "hub") 6 7 2008-09-18 MickeM - 0.3.4 8 * Changed so "missing services" are treated as stopped. 9 CheckServiceState missing=stopped ShowAll 10 OK: missing: not found 11 * Fixed issue with : in service name. 12 + Added some "reasonable default cheks" under [External Alias] for the CheckExternalScripts.dll module. 6 13 7 14 2008-09-17 MickeM - 0.3.4 RC-6 -
include/EnumNtSrv.cpp
r846bbe4 rbb8b6d1 189 189 SC_HANDLE sh = ::OpenService(scman,name.c_str(),SERVICE_QUERY_STATUS); 190 190 if (!sh) { 191 std::wstring short_name; 191 192 DWORD bufLen = SC_BUF_LEN; 192 193 TCHAR *buf = new TCHAR[bufLen+1]; 193 194 if (GetServiceKeyName(scman, name.c_str(), buf, &bufLen) == 0) { 195 short_name = name; 196 } else { 197 short_name = buf; 198 } 199 delete [] buf; 200 sh = ::OpenService(scman,short_name.c_str(),SERVICE_QUERY_STATUS); 201 if (sh == NULL) { 202 DWORD dwErr = GetLastError(); 194 203 ::CloseServiceHandle(scman); 195 delete [] buf; 196 throw NTServiceException(name, _T("GetServiceKeyName: Could not translate service name: ") + error::lookup::last_error()); 197 } 198 /* 199 Why does this not work? (a bug in the API? says it should return the correct size?) 200 if (bufLen >= SC_BUF_LEN) { 201 ::CloseServiceHandle(scman); 202 throw NTServiceException(name, "Service name to long to handle", GetLastError()); 203 } 204 buf[bufLen] = 0; 205 */ 206 sh = ::OpenService(scman,buf,SERVICE_QUERY_STATUS); 207 delete [] buf; 208 if (sh == NULL) { 209 ::CloseServiceHandle(scman); 210 throw NTServiceException(name, _T("OpenService: Could not open Service: ") + error::lookup::last_error()); 204 if (dwErr == ERROR_SERVICE_DOES_NOT_EXIST) { 205 info.m_dwCurrentState = MY_SERVICE_NOT_FOUND; 206 info.m_dwServiceType = MY_SERVICE_NOT_FOUND; 207 return info; 208 } else { 209 throw NTServiceException(name, _T("OpenService: Could not open Service: ") + error::lookup::last_error(dwErr)); 210 } 211 211 } 212 212 } -
include/EnumNtSrv.h
r34e7428 rbb8b6d1 47 47 } 48 48 }; 49 #define MY_SERVICE_NOT_FOUND 0xffff0000 49 50 50 51 class TNtServiceInfo { -
include/checkHelpers.hpp
r7221dc8 rbb8b6d1 298 298 299 299 typedef unsigned long state_type; 300 const int state_none = 0x00; 301 const int state_started = 0x01; 302 const int state_stopped = 0x02; 300 const int state_none = 0x00; 301 const int state_started = 0x01; 302 const int state_stopped = 0x02; 303 const int state_not_found = 0x06; 303 304 304 305 class state_handler { … … 314 315 else if (*it == _T("ignored")) 315 316 ret |= state_none; 317 else if (*it == _T("not found")) 318 ret |= state_not_found; 316 319 } 317 320 return ret; … … 324 327 else if (value == state_none) 325 328 return _T("none"); 329 else if (value == state_not_found) 330 return _T("not found"); 326 331 return _T("unknown"); 327 332 } -
include/config.h
r371df23 rbb8b6d1 26 26 27 27 // Version 28 //#define SZBETATAG _T(" ")29 #define SZBETATAG _T(" RC ")28 #define SZBETATAG _T(" ") 29 //#define SZBETATAG _T(" RC ") 30 30 //#define SZBETATAG _T(" BETA ") 31 31 #define SZVERSION STRPRODUCTVER SZBETATAG STRPRODUCTDATE -
modules/CheckSystem/CheckSystem.cpp
rbc97cd8 rbb8b6d1 483 483 else if (state == SERVICE_STOPPED) 484 484 return checkHolders::state_stopped; 485 else if (state == MY_SERVICE_NOT_FOUND) 486 return checkHolders::state_not_found; 485 487 return checkHolders::state_none; 486 488 } … … 534 536 MAP_OPTIONS_BOOL_TRUE(_T("CheckAll"), bAutoStart) 535 537 MAP_OPTIONS_INSERT(_T("exclude"), excludeList) 536 MAP_OPTIONS_SECONDARY_BEGIN(_T(":"), p2)537 MAP_OPTIONS_MISSING_EX(p2, msg, _T("Unknown argument: "))538 MAP_OPTIONS_SECONDARY_END()538 //MAP_OPTIONS_SECONDARY_BEGIN(_T(":"), p2) 539 //MAP_OPTIONS_MISSING_EX(p2, msg, _T("Unknown argument: ")) 540 //MAP_OPTIONS_SECONDARY_END() 539 541 else { 540 542 tmpObject.data = p__.first; … … 594 596 if (!msg.empty()) msg += _T(" - "); 595 597 msg += (*it).data + _T(": Stopped"); 598 } else if (info.m_dwCurrentState == MY_SERVICE_NOT_FOUND) { 599 if (!msg.empty()) msg += _T(" - "); 600 msg += (*it).data + _T(": Not found"); 596 601 } else { 597 602 if (!msg.empty()) msg += _T(" - "); … … 615 620 else if (info.m_dwCurrentState == SERVICE_STOPPED) 616 621 value = checkHolders::state_stopped; 622 else if (info.m_dwCurrentState == MY_SERVICE_NOT_FOUND) 623 value = checkHolders::state_not_found; 617 624 else 618 625 value = checkHolders::state_none; 619 626 (*it).perfData = bPerfData; 627 (*it).setDefault(tmpObject); 620 628 (*it).runCheck(value, returnCode, msg, perf); 621 629 } … … 623 631 } 624 632 if (msg.empty()) 625 msg = _T("OK: All services are running.");633 msg = _T("OK: All services are in their apropriate state."); 626 634 else if (!bNSClient) 627 635 msg = NSCHelper::translateReturn(returnCode) + _T(": ") + msg;
Note: See TracChangeset
for help on using the changeset viewer.








