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.
Custom Field Creation and Enrichment
Re: Custom Field Creation and Enrichment
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
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
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
dwhitfield
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Custom Field Creation and Enrichment
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.mcapra wrote:Could you share a little bit more regarding what you'd like to do with that field?
Re: Custom Field Creation and Enrichment
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Custom Field Creation and Enrichment
Do you mean for each host? Or do you want to enter the information after something goes wrong and it creates an alert?busszz wrote:For each 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
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
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
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Custom Field Creation and Enrichment
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
Here is a XI component primer
https://support.nagios.com/kb/article/n ... nents.html
Re: Custom Field Creation and Enrichment
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
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
You do not have the required permissions to view the files attached to this post.
Re: Custom Field Creation and Enrichment
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.
Former Nagios employee
Re: Custom Field Creation and Enrichment
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
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