We have an HP OpenView server on which we have logs that are read via an active check. These logs contain the name of hosts which are also configured on the Nagios XI server. The active check on the HP OpenView server "alarms" as the HOSTNAME of the HP OpenView server, so it looks like the "alarm" was on the HP OpenView server.
I want to report the alarm as the host that was found in the log file without using a passive check. In effect, I want to alter the HOSTNAME value of an event based upon a value found in the log entry that triggered it. It would be possible within the service check to parse that log entry and extract the desired hostname, but I don't know how to then tell the Nagios XI server that the event is actually for a server other than the one that sent the alarm.
I checked for "proxy" (which is the what this is), but there are hundreds of entries mostly relating to web proxies. I'm hoping there's a more formal way to do achieve this.
Thank you.
How to change HOSTNAME when host acting as a collector
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: How to change HOSTNAME when host acting as a collector
It might be possible but you'd have to define all of the different hosts on your NagiosXI server
1) Create new host
2) New host has same IP as HP OpenView box
3) Add an argument or a wrapper to your service check log grokker thingie:
Complicated - but that's how I envision you achieving the desired goal (without passive).
One thing is certain - NagiosXI will not dynamically create those hosts for you without some black magic in your plugin. You will have to define them.
1) Create new host
2) New host has same IP as HP OpenView box
3) Add an argument or a wrapper to your service check log grokker thingie:
Code: Select all
if [ $error ] && [ $hostname -eq $me ]; then
dostuff();
fiOne thing is certain - NagiosXI will not dynamically create those hosts for you without some black magic in your plugin. You will have to define them.
Re: How to change HOSTNAME when host acting as a collector
This is sort of what I figured or there would need to be some arcane backend manipulation of the event which would be risky.
I sounds like I'd have to use a passive check where I can set the HOSTNAME and other values.
I have code to automatically import new passive checks rather than having to accept them manually.
Thank you.
I sounds like I'd have to use a passive check where I can set the HOSTNAME and other values.
I have code to automatically import new passive checks rather than having to accept them manually.
Thank you.
-
jdalrymple
- Skynet Drone
- Posts: 2620
- Joined: Wed Feb 11, 2015 1:56 pm
Re: How to change HOSTNAME when host acting as a collector
Passive would be the way to go then. As mentioned - your configs HAVE TO HAVE the host definitions, so if your code can take care of that I'd say that's about 3/4 of the battle.mp4783 wrote:I have code to automatically import new passive checks rather than having to accept them manually.
OK to close?