Page 1 of 2
Custom Field Creation and Enrichment
Posted: Mon Sep 04, 2017 1:05 am
by busszz
Hello All,
We need inputs from you all on how to create a custom field in Nagios X1 and assign a value to it dynamically.
Example:
1. Creating custom field 'AdditionalInfo'.
2. Based on the host name of the alarm, a value to be assigned to the 'AdditionalInfo' Field
Thanks in advance.
Re: Custom Field Creation and Enrichment
Posted: Tue Sep 05, 2017 12:33 pm
by mcapra
Could you share a little bit more regarding what you'd like to do with that field?
If the value is dynamic and changes frequently, I don't think traditional
custom variables are the way to handle this. Custom variables are part of a configuration object, and modifying them would (for the current version of Nagios Core) require a full restart of the Nagios daemon. Not exactly ideal if they're changed frequently.
If you want these variables to be part of some third party integration, I'd write a custom API endpoint to handle resolving the value(s). Here's a little example I did a while back that might get you on the right path:
https://support.nagios.com/forum/viewto ... 93#p214393
Re: Custom Field Creation and Enrichment
Posted: Tue Sep 05, 2017 3:19 pm
by dwhitfield
mcapra wrote:Could you share a little bit more regarding what you'd like to do with that field?
Yes, that would be very useful. In an abstract sense, I think
https://assets.nagios.com/downloads/nag ... ios-XI.pdf may be of use for you.
Re: Custom Field Creation and Enrichment
Posted: Wed Sep 06, 2017 1:13 am
by busszz
Thanks guys for the responds.
Here is the details information on the request.
We need to create two fields say "EquipmentType" and "Customer".
For each alert, based on the IP Address, we would need to populate EquipmentType with what type of device it is and in the Customer field we need to populate the device belongs to which customer.
Thanks,
Nagaraju Samudrala
Re: Custom Field Creation and Enrichment
Posted: Wed Sep 06, 2017 9:56 am
by scottwilkerson
busszz wrote:For each alert
Do you mean for each host? Or do you want to enter the information after something goes wrong and it creates an alert?
If you mean for Each host you may be able to use Free Variables for that, you can set them in the CCM.
If you mean each time a hosts generates an alert, you would have to create your own custom component like
@dwhitfield suggested.
Re: Custom Field Creation and Enrichment
Posted: Mon Sep 11, 2017 3:21 am
by busszz
Hello scottwilkerson,
Thanks for your responds. Yes, we need this for every alert.
For example, if the alert is from '192.156.23.3', EquipmentType field should be populated with 'Switch' and Customer field should be populated with 'ABC'.
For all the alerts, this should done dynamically.
Also, we tried using Notes plugin, and modified it to create another column but nagios become inaccessable on creating the second column.
Could you please let us know how this can be implemented.
Thanks,
Nagaraju Samudrala
Re: Custom Field Creation and Enrichment
Posted: Mon Sep 11, 2017 9:10 am
by scottwilkerson
When modifying you need to change the name of the folder and the xxxxx.inc.php file as well as the finction names so you do not have any duplicate function names.
Here is a XI component primer
https://support.nagios.com/kb/article/n ... nents.html
Re: Custom Field Creation and Enrichment
Posted: Thu Sep 14, 2017 1:39 am
by busszz
Hello Scott,
Thanks for you assistance. Now I am able to create multiple custom fields. But I could not find those fields in any of the database tables.
Could you please help me in assigning values to the notes fields based on host field value as below when an alert is received.
For Example:
Host=192.168.16.129 should have notes field as Switch
Host=192.168.16.69 should have notes field as Firewall
Host=192.168.16.xxx should have notes field as Laptop
Thanks,
Nagaraju Samudrala
Re: Custom Field Creation and Enrichment
Posted: Thu Sep 14, 2017 1:25 pm
by tmcdonald
This is getting pretty close to consulting at this point. If you are interested we could have our Sales team contact you with some options for custom development, otherwise this is stepping out of scope for the forums. You are free to make whatever modifications you need, but for us to tell you exactly what to change and how would need to be billed as consulting.
Re: Custom Field Creation and Enrichment
Posted: Fri Sep 15, 2017 12:50 am
by busszz
Hello Tmcdonald,
We understand that we are asking for detailed information on how to achieve the requirement. We have gone through documentation and the links that are provided on how to build custom components. From those only we are able to create multiple fields in hosts table.
But for assigning the values to fields and customizing the alert information dynamically, we could not find exactly what to do, though we have gone through the files in /usr/local/nagios/etc/
It would be helpful for us, if you can provide us some guide lines on how alert values are populated, how alerts can be modified as needed and assigning values to custom fields.
Thanks,
Nagaraju Samudrala