Opened 6 years ago

Closed 5 years ago

Last modified 3 years ago

#69 closed defect (fixed)

include statement to extend NSC.ini

Reported by: wob Owned by:
Priority: 3 Milestone: 0.4.0
Component: None Version: 0.3.1
Severity: Bugs Keywords:
Cc:

Description

It would be great if we can use an include statement to extend NSC.ini:

include=C:\nrpe\nrpe.cfg

Change History (11)

comment:1 Changed 6 years ago by mickem

  • Resolution set to fixed
  • Severity changed from Bugs to Feature Requests
  • Status changed from new to closed

Will be in next build: use like so:

[includes]
file1.ini
file2.ini
file3.ini
; ... (etc) ...

MickeM

comment:2 Changed 5 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 0.2.7 to 0.3.0

It would be nice if we can include automatically a configuration <hostname>.ini.
Settings specific for a host (for instance NRPE Handlers) are in <hostname>.ini and settings for all hosts in nsc.ini.
With this enhancement, it's easy to update the NSClient++.
What happens if an include has a section that is also inside NSC.ini. Which one has the priority?

comment:3 follow-up: Changed 5 years ago by mickem

  • Milestone changed from 0.3.0 to 0.4.0

you mean:

[include]
$hostname$.ini

or some such?

you can now include a file called "myhost.ini".

As for what happens when include files overrides each other there is an order, cant recall off the top of my head now but it is simple to try.

MickeM

comment:4 in reply to: ↑ 3 Changed 5 years ago by anonymous

[include]
$hostname$.ini

This would be a very good solution!

comment:5 Changed 5 years ago by Sascha

Is the [include] already working? 0.3.0 suggests so, but it seems to totally ignore any settings there...

S

comment:6 Changed 5 years ago by anonymous

  • Resolution set to worksforme
  • Status changed from reopened to closed

I just tried it and it seems to works here...
nsc.ini

...
[include]
nsca.ini
...

and it loaded that file and even "merged" in some of the sections...

MickeM

comment:7 Changed 5 years ago by mickem

  • Milestone changed from 0.4.0 to 0.3.1

comment:8 Changed 5 years ago by Sascha

  • Resolution worksforme deleted
  • Status changed from closed to reopened

Maybe I'm totally dumb... but it doesn't work for me :)

  1. In your example you write [include], yet the default nsc.ini states [includes] - which is the correct form?
  1. How is the additional .ini meant to be set up? Should it contain module tags ([NRPEHandler] e.g.) or not?

The following does _not_ work for me (0.3.1):

In my nsc.ini:

[include]
local.ini

In local.ini:

[NRPE Handlers]
command[check_ROOT]=inject CheckDriveSize ShowAll=long Drive=C: MaxWarnUsed=90% MaxCritUsed=95%
command[check_SAN1]=inject CheckDriveSize ShowAll=long Drive=E: MaxWarnUsed=90% MaxCritUsed=95%
command[check_SAN2]=inject CheckDriveSize ShowAll=long Drive=F: MaxWarnUsed=90% MaxCritUsed=95%
command[check_SAN3]=inject CheckDriveSize ShowAll=long Drive=G: MaxWarnUsed=90% MaxCritUsed=95%
command[check_SWAP]=inject CheckMem ShowAll=long type=virtual MaxWarn=75% MaxCrit=90%

Those commands are not available when starting nsclient++, neither in /test, nor in standard mode. Anything I am missing here?

On a sidenote: I do not see any output regarding the local.ini when doing /test, does it produce output when loading additional ini files? If not, it really should.

S

PS: Should we keep it in this ticket or emerge into a new one? Since it's actually not a feature enhancement anymore, but a bug (or stupid user - who knows...)

comment:9 Changed 5 years ago by mickem

  • Milestone changed from 0.3.1 to 0.4.0
  • Priority changed from 1 to 3
  • Severity changed from Feature Requests to Bugs
  • Type changed from enhancement to defect
  • Version changed from 0.3.0 to 0.3.1

Humm..

checked source and I think it should be: includes, and the included file is included "as if" it was a normal nsc.ini so sections and such should be the same.

(ie. your example looked ok apart from it should have been includes)
I does not seem to print anything, maybe I should add that...

I shall look into this more when I get home.

MickeM

comment:10 follow-up: Changed 5 years ago by mickem

  • Resolution set to fixed
  • Status changed from reopened to closed

humm...

1, it cant really log, there 1, no context to log to and 2, logger is not loaded "yet".
I shall fix this issues for the rework of the settings system for 0.4.0 version.

And this works for me:
(notice: [includes])

nsca.ini

[modules]
NSCAAgent.dll

[NSCA Agent]
;# CHECK INTERVALL (in seconds)
;   How often we should run the checks and submit the results.
interval=5
;
;# ENCRYPTION METHOD
;   This option determines the method by which the send_nsca client will encrypt the packets it sends 
;   to the nsca daemon. The encryption method you choose will be a balance between security and 
;   performance, as strong encryption methods consume more processor resources.
;   You should evaluate your security needs when choosing an encryption method.
;
; Note: The encryption method you specify here must match the decryption method the nsca daemon uses 
;       (as specified in the nsca.cfg file)!!
; Values:
;	0 = None	(Do NOT use this option)
;	1 = Simple XOR  (No security, just obfuscation, but very fast)
;   2 = DES
;   3 = 3DES (Triple DES)
;	4 = CAST-128
;	6 = xTEA
;	8 = BLOWFISH
;	9 = TWOFISH
;	11 = RC2
;	14 = RIJNDAEL-128 (AES)
;	20 = SERPENT
encryption_method=14
;
;# ENCRYPTION PASSWORD
;# This is the password/passphrase that should be used to encrypt the
;# sent packets. 
password=secret-password
;
;# BIND TO ADDRESS
;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
;  Leaving this blank will bind to "one" local interface.
;bind_to_address=
nsca_host=192.168.0.1
nsca_port=5667
debug_threads=100

[NSCA Commands]
check_self_nrpe=check_self_nrpe

nsc.ini

[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;  You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; *                                                               *
; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *
; *                                                               *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
NSClientListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckExternalScripts.dll
NRPEClient.dll

[Settings]
;# USE THIS FILE
;  Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1 
;  the registry will be used instead.
use_file=1
string_length=16000

[includes]
nsca.ini

MickeM

comment:11 in reply to: ↑ 10 Changed 3 years ago by mike3050

Replying to mickem:

humm...

1, it cant really log, there 1, no context to log to and 2, logger is not loaded "yet".
I shall fix this issues for the rework of the settings system for 0.4.0 version.

And this works for me:
(notice: [includes])

nsca.ini

[modules]
NSCAAgent.dll

[NSCA Agent]
;# CHECK INTERVALL (in seconds)
;   How often we should run the checks and submit the results.
interval=5
;
;# ENCRYPTION METHOD
;   This option determines the method by which the send_nsca client will encrypt the packets it sends 
;   to the nsca daemon. The encryption method you [http://zolpo.com/life-insurance/ life insurance quote] choose will be a balance between security and 
;   performance, as strong encryption methods consume more processor resources.
;   You should evaluate your security needs when choosing an encryption method.
;
; Note: The encryption method you specify here must match the decryption method the nsca daemon uses 
;       (as specified in the nsca.cfg file)!!
; Values:
;	0 = None	(Do NOT use this option)
;	1 = Simple XOR  (No security, just obfuscation, but very fast)
;   2 = DES
;   3 = 3DES (Triple DES)
;	4 = CAST-128
;	6 = xTEA
;	8 = BLOWFISH
;	9 = TWOFISH
;	11 = RC2
;	14 = RIJNDAEL-128 (AES)
;	20 = SERPENT
encryption_method=14
;
;# ENCRYPTION PASSWORD
;# This is the password/passphrase that should be used to encrypt the
;# sent packets. 
password=secret-password
;
;# BIND TO ADDRESS
;  Allows you to bind server to a specific local address. This has to be a dotted ip adress not a hostname.
;  Leaving this blank will bind to "one" local interface.
;bind_to_address=
nsca_host=192.168.0.1
nsca_port=5667
debug_threads=100

[NSCA Commands]
check_self_nrpe=check_self_nrpe

nsc.ini

[modules]
;# NSCLIENT++ MODULES
;# A list with DLLs to load at startup.
;  You will need to enable some of these for NSClient++ to work.
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
; *                                                               *
; * N O T I C E ! ! ! - Y O U   H A V E   T O   E D I T   T H I S *
; *                                                               *
; ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
FileLogger.dll
CheckSystem.dll
NSClientListener.dll
SysTray.dll
CheckEventLog.dll
CheckHelpers.dll
CheckExternalScripts.dll
NRPEClient.dll

[Settings]
;# USE THIS FILE
;  Use the INI file as opposed to the registry if this is 0 and the use_reg in the registry is set to 1 
;  the registry will be used instead.
use_file=1
string_length=16000

[includes]
nsca.ini

MickeM

Thank you.

Note: See TracTickets for help on using tickets.