kafelez / jsendnsca

Automatically exported from code.google.com/p/jsendnsca
0 stars 0 forks source link

Problem on send mensage #47

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Raj, I know it's so long since last issue and maybe you don't work any more 
in this project but I need to ask you.

I'm using the last version of your API (2.1.1) and the following class:

public class NscaSend {
  public static void main(String[] args) {
    NagiosSettings settings = new NagiosSettingsBuilder()
      .withNagiosHost("mysqerver.com")
      .withPort(5667)
      .withPassword("password")
      .withEncryption(Encryption.NONE)
      .create();

    MessagePayload payload = new MessagePayloadBuilder()
      .withHostname("jnsca")
      .withLevel(Level.OK)
      .withServiceName("nscasender")
      .withMessage("should work if everything set up OK")
      .create();

    NagiosPassiveCheckSender sender = new NagiosPassiveCheckSender(settings);

    try {
      sender.send(payload);
    } catch (NagiosException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

In my server, the windows hosts are sending correctly messages like this:

[1407270232] PASSIVE HOST CHECK: host-windows;0;OK: Lets pretend everything is 
going to be ok.

I'm using Eclipse to edit source code and compile the test program on a 
Operating System Mac X. When I run the program on the Eclipse I have no errors, 
but the server receive no message. Can you help me?

If the program works, it will save my life. I've been looking for weeks. 
Congratulations.

Original issue reported on code.google.com by Jocyvan....@gmail.com on 5 Aug 2014 at 9:12

GoogleCodeExporter commented 8 years ago
OK, few details to help me help you

1. How are you sending messages from windows? Are you using the same code on 
windows and it works?
2. What is the hostname of where the Nagios NSCA program is running on.
3. Can you confirm it is listening on port 5667

Original comment by rajneeshpatel on 5 Aug 2014 at 9:20

GoogleCodeExporter commented 8 years ago
On my windows hosts, I'm using NSClient++ (form this page: 
http://nsclient.org/nscp) configured to send the messages to my NSCA server 
hosted on a Amazon Server with a address .com configured. I can see the NSCA 
server receiving messages from windows hosts, like that:
[1407270232] PASSIVE HOST CHECK: host-windows;0;OK: Lets pretend everything is 
going to be ok.
NSCA server hostname is ip-172-31-16-228 (odd, I know, but that's it).

Thanks for your patience and attention.

Original comment by Jocyvan....@gmail.com on 6 Aug 2014 at 12:31

GoogleCodeExporter commented 8 years ago
Hi Raj, I solve it. I made a basic mistake. On server the encryption is set 1 
(xor) and on jnsca host was setted 0 (none), but now it's all right.

Original comment by Jocyvan....@gmail.com on 6 Aug 2014 at 1:30

GoogleCodeExporter commented 8 years ago
Thanks for all. Sorry for my terrible english and too many messages.

Original comment by Jocyvan....@gmail.com on 6 Aug 2014 at 1:32

GoogleCodeExporter commented 8 years ago
No problem and glad you've got it working now

Raj

Original comment by rajneeshpatel on 6 Aug 2014 at 8:42