Module: check_mk
Branch: master
Commit: 1d1d45f8e71d55ff958f433be0b7bb29dcca80cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d1d45f8e71d55…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Apr 5 13:04:23 2013 +0200
check_mk.ini: new option 'port' - specifies agent port
---
ChangeLog | 1 +
agents/windows/check_mk.example.ini | 3 +++
agents/windows/check_mk_agent.cc | 13 +++++++++----
agents/windows/check_mk_agent.exe | Bin 111104 -> 111104 bytes
agents/windows/install_agent.exe | Bin 130964 -> 131002 bytes
5 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 75cbff4..ff883ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -61,6 +61,7 @@
snapshotted during inventory.
* smart.temp: add WATO configuration
* if64_tplink: special new check for TP Link switches with broken SNMP output
+ * windows_agent: check_mk.ini: new option "port" - specifies agent port
Notifications:
* notify.py: unique spoolfiles name no longer created with uuid
diff --git a/agents/windows/check_mk.example.ini b/agents/windows/check_mk.example.ini
index 2929fc6..84eb9bf 100644
--- a/agents/windows/check_mk.example.ini
+++ b/agents/windows/check_mk.example.ini
@@ -2,6 +2,9 @@
# Restrict access to certain IP addresses
# only_from = 127.0.0.1 192.168.56.0/24
+ # Change port where the agent is listening ( default 6556 )
+ # port = 6556
+
# Do only execute programs and scripts with
# the following suffixes (in local and plugins).
# Per default all extensions except txt and dir
diff --git a/agents/windows/check_mk_agent.cc b/agents/windows/check_mk_agent.cc
index d558c0f..019fd26 100755
--- a/agents/windows/check_mk_agent.cc
+++ b/agents/windows/check_mk_agent.cc
@@ -158,6 +158,7 @@ bool do_tcp = false;
bool should_terminate = false;
bool force_tcp_output = false; // if true, send socket data immediately
char g_hostname[256];
+int g_port = CHECK_MK_AGENT_PORT;
// sections enabled (configurable in check_mk.ini)
unsigned long enabled_sections = 0xffffffff;
@@ -2636,6 +2637,10 @@ if (!strcmp(var, "only_from")) {
parse_only_from(value);
return true;
}
+ else if (!strcmp(var, "port")) {
+ g_port = atoi(value);
+ return true;
+ }
else if (!strcmp(var, "execute")) {
parse_execute(value);
return true;
@@ -3013,14 +3018,14 @@ void listen_tcp_loop()
SOCKADDR_IN addr;
memset(&addr, 0, sizeof(SOCKADDR_IN));
addr.sin_family = AF_INET;
- addr.sin_port = htons(CHECK_MK_AGENT_PORT);
+ addr.sin_port = htons(g_port);
addr.sin_addr.s_addr = ADDR_ANY;
int optval = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char*)&optval, sizeof(optval));
if (SOCKET_ERROR == bind(s, (SOCKADDR *)&addr, sizeof(SOCKADDR_IN))) {
- fprintf(stderr, "Cannot bind socket to port %d\n", CHECK_MK_AGENT_PORT);
+ fprintf(stderr, "Cannot bind socket to port %d\n", g_port);
exit(1);
}
@@ -3149,7 +3154,7 @@ void usage()
"check_mk_agent remove -- remove Windows NT service\n"
"check_mk_agent adhoc -- open TCP port %d and answer request until
killed\n"
"check_mk_agent test -- test output of plugin, do not open TCP port\n"
- "check_mk_agent debug -- similar to test, but with lots of debug
output\n", CHECK_MK_AGENT_PORT);
+ "check_mk_agent debug -- similar to test, but with lots of debug
output\n", g_port);
exit(1);
}
@@ -3174,7 +3179,7 @@ void do_test()
void do_adhoc()
{
do_tcp = true;
- printf("Listening for TCP connections on port %d\n", CHECK_MK_AGENT_PORT);
+ printf("Listening for TCP connections on port %d\n", g_port);
printf("Close window or press Ctrl-C to exit\n");
fflush(stdout);
diff --git a/agents/windows/check_mk_agent.exe b/agents/windows/check_mk_agent.exe
index 3f21a99..e209d4d 100755
Binary files a/agents/windows/check_mk_agent.exe and b/agents/windows/check_mk_agent.exe
differ
diff --git a/agents/windows/install_agent.exe b/agents/windows/install_agent.exe
index bf76f55..e4adf64 100755
Binary files a/agents/windows/install_agent.exe and b/agents/windows/install_agent.exe
differ