sshikov / jsendnsca

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

Is it possible to send hostname with message string? #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi Raj,

Is it possible with the current MessagePayloadBuilder to send the sending 
server hostname with the Message string instead of the Hostname expected by the 
Nagios server? 

For example if currently things look like this on Nagios:

Host     Service    Status  ....   Status Info
host_A   service_1  OK      ....   OK message
         service_2  ERROR   ....   ERROR message
host_B   service_1  OK      ....   OK message
         service_2  ERROR   ....   ERROR message

Can we do the following instead:

Host     Service    Status  ....   Status Info
allhosts service_1  OK      ....   host_A: OK message
         service_2  ERROR   ....   host_B: ERROR message

Thanks

Original issue reported on code.google.com by asimeo...@gmail.com on 13 Jul 2011 at 9:32

GoogleCodeExporter commented 9 years ago
Sounds like what you are describing is aggregating the results of a single 
service across all hosts. Passive Checks AFAIK relate to the status of a 
service from a single host

What would you expect to see in Status Info if Host A, Service 1 was OK and 
Host B, Service 1 was ERROR? Would it be the most severe status or the latest 
received which could be from Host A OK?

Sounds more like a question regarding Nagios and its capabilities to do this 
sort of aggregation. Sorry couldnt be of any more help.

Original comment by rajneeshpatel on 13 Jul 2011 at 10:21

GoogleCodeExporter commented 9 years ago
Of course, if Nagios is can do this sort of aggregation, you can always include 
the hostname of the sending host in the message as it is just a string i.e. 

String hostname = "host123";
 MessagePayload payload = new MessagePayloadBuilder()
            .withHostname(hostname)
            .withLevel(Level.OK)
            .withServiceName("Service Name")
            .withMessage(hostname + ": message including hostname")
            .create();

Original comment by rajneeshpatel on 13 Jul 2011 at 10:25

GoogleCodeExporter commented 9 years ago
Correct - the idea is to aggregate the single service across all hosts and 
display just the latest received status from whichever host.

However I'd rather retrieve the hostname using .withLocalHostname() and then 
send it with 

.withMessage(hostname + ": message including hostname")

Original comment by asimeo...@gmail.com on 15 Jul 2011 at 9:16

GoogleCodeExporter commented 9 years ago
That will work I guess, but the danger is you miss an ERROR or WARN on a host 
if its overridden by an OK from another host later on.

However, you may want to check out features in nagios such as hostgroup-summary 
(http://nagios.sourceforge.net/images/screens/new/hostgroup-summary.png) which 
may achieve what you need without having to send alerts using the same hostname 

Original comment by rajneeshpatel on 15 Jul 2011 at 9:26

GoogleCodeExporter commented 9 years ago

Original comment by rajneeshpatel on 25 Oct 2012 at 8:12