mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
243 stars 94 forks source link

0.4.3.88 flags property of PDH counter can be specified as check_pdh argumnet, but not in INI #88

Closed MilanDadok closed 9 years ago

MilanDadok commented 9 years ago

some counters values must be saved to RRD buffer with better precision to correctlly calculate average, but flags atribute of counter is not read from INI

next patch solve that problem [/settings/system/windows/counters/LogicalDiskCAvgDiskSecWrite] flags = 1000

diff --git a/modules/CheckSystem/CheckSystem.cpp b/modules/CheckSystem/CheckSystem.cpp
index 2aab6e4..3adc195 100644
--- a/modules/CheckSystem/CheckSystem.cpp
+++ b/modules/CheckSystem/CheckSystem.cpp
@@ -182,6 +182,7 @@ bool CheckSystem::loadModuleEx(std::string alias, NSCAPI::moduleLoadMode mode) {
                counter.set_instances(object.instances);
                counter.set_buffer_size(object.buffer_size);
                counter.set_type(object.type);
+               counter.set_flags(object.flags);

                collector->add_counter(counter);
            } catch (const PDH::pdh_exception &e) {
diff --git a/modules/CheckSystem/check_pdh.cpp b/modules/CheckSystem/check_pdh.cpp
index 3ba5c4a..36db310 100644
--- a/modules/CheckSystem/check_pdh.cpp
+++ b/modules/CheckSystem/check_pdh.cpp
@@ -81,6 +81,8 @@ namespace check_pdh {
            "BUFFER SIZE", "Size of buffer (in seconds) larger buffer use more memory")
            ("type", sh::string_key(&object.type),
            "COUNTER TYPE", "The type of counter to use long, large and double")
+           ("flags", sh::string_key(&object.flags),
+           "FLAGS", "Extra flags to configure the counter (nocap100, 1000, noscale)")
            ;

        object.tpl.read_object(root_path);
diff --git a/modules/CheckSystem/check_pdh.hpp b/modules/CheckSystem/check_pdh.hpp
index 170e03d..16f20b3 100644
--- a/modules/CheckSystem/check_pdh.hpp
+++ b/modules/CheckSystem/check_pdh.hpp
@@ -22,6 +22,7 @@ namespace check_pdh {
        std::string instances;
        std::string buffer_size;
        std::string type;
+       std::string flags;

        // Runtime items
mickem commented 9 years ago

Sounds good...

How about a pull request?

MilanDadok commented 9 years ago

Hi I'm new to git, probablly I can pull all in one request In help I found how to make branch of own repository, but not not how to make branch (for commit) from another user I there some help page how to make that?

Best Regards Milan Dadok

From: Michael Medin [mailto:notifications@github.com] Sent: Wednesday, January 21, 2015 8:37 PM To: mickem/nscp Cc: Dadok Milan Subject: Re: [nscp] 0.4.3.88 flags property of PDH counter can be specified as check_pdh argumnet, but not in INI (#88)

Sounds good...

How about a pull request?

— Reply to this email directly or view it on GitHubhttps://github.com/mickem/nscp/issues/88#issuecomment-70906132.

MilanDadok commented 9 years ago

after some git rebasing I pushed commit to correct forker repository

Best Regards Milan Dadok

PS. I have big problem to make succesfull build on windows, I made next notes

A) fetchdeps.py change to msver = '2012'

B) --- a/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc +++ b/third_party/protobuf/src/google/protobuf/compiler/command_line_interface.cc @@ -910,7 +910,7 @@ bool CommandLineInterface::InterpretArgument(const string& name, cerr << disk_path << ": warning: directory does not exist." << endl; }

C) Openssl OUT32 (there are only .lib) -> OUT32DLL

D) protobuf-2.4.1 change all .vxcproj MultiThread to MultiThreadDLL

E) json-protobuf lua-protobuf run python setup.py install copy protoc-gen-lua to .\lua_protobuf.egg-info\scripts\

            protoc-gen-json to to .\lua_protobuf.egg-info\scripts\

From: Dadok Milan Sent: Wednesday, January 21, 2015 8:57 PM To: 'mickem/nscp'; 'mickem/nscp' Subject: RE: [nscp] 0.4.3.88 flags property of PDH counter can be specified as check_pdh argumnet, but not in INI (#88)

Hi I'm new to git, probablly I can pull all in one request In help I found how to make branch of own repository, but not not how to make branch (for commit) from another user I there some help page how to make that?

Best Regards Milan Dadok

From: Michael Medin [mailto:notifications@github.com] Sent: Wednesday, January 21, 2015 8:37 PM To: mickem/nscp Cc: Dadok Milan Subject: Re: [nscp] 0.4.3.88 flags property of PDH counter can be specified as check_pdh argumnet, but not in INI (#88)

Sounds good...

How about a pull request?

— Reply to this email directly or view it on GitHubhttps://github.com/mickem/nscp/issues/88#issuecomment-70906132.

mickem commented 9 years ago

Pullrequests are a really nice way to send code, you can see some details here: https://help.github.com/articles/using-pull-requests/ in essence you fork, commit, push and then create the pull request for the commit on github. Then I can just click merge and it is merged :)

As for the other issue (build) please open a new defect with some details and I will look into it. Which version of vc do you have? I am using 2012 myself so that "should work" 2013 should also presumably work but fetchdeps might not... earlier versions "could work" but 2005 will not for instance since I am using "newer compiler features"...

mickem commented 9 years ago

Should be fixed in the latest nightly build (0.4.3.90)