I want to add additional column to below image, is that possible ?
Foreman and Proxy versions:
foreman 2.5
Distribution and version:
Ubuntu 18.04 LTS
Thanks in advance
Regards
Neeloj
I want to add additional column to below image, is that possible ?
Foreman and Proxy versions:
foreman 2.5
Distribution and version:
Ubuntu 18.04 LTS
Thanks in advance
Regards
Neeloj
There is GitHub - theforeman/foreman_column_view: A simple Foreman plugin showcasing Deface for altering the Hosts view but the installation should mention that you can use the installer (foreman-installer --enable-foreman-plugin-column-view
from the top of my head). Perhaps that helps you?
thank you so much @ekohl , I had below error with that:
#: foreman-installer --enable-foreman-plugin-column-view
2021-07-13 10:57:26 [NOTICE] [root] Loading installer configuration. This will take some time.
2021-07-13 10:57:34 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2021-07-13 10:57:34 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2021-07-13 10:57:36 [ERROR ] [root] Parameter foreman-plugin-column-view-columns invalid: Hash value elements are invalid: nil is not a valid hash
Error during configuration, exiting
I install the plugin via apt-get, and its listed in plugins on GUI:
but the file /etc/foreman/plugins/foreman_column_view.yaml
is not available, is there any trick or any .example files ?
thanks in advance
check this file /etc/foreman/plugins/foreman_column_view.yaml.example, adapt it, rename it and restart foreman.
This file is available with rpm, not sure with apt flavour. If not, here the sample:
cat /etc/foreman/plugins/foreman_column_view.yaml.example
# Copy this file to foreman_column_view.yaml to enable, then restart Foreman
#
# See tfm-rubygem-foreman_column_view-doc and /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_column_view-0.4.0/README.md for more information
:column_view:
:architecture:
:title: Architecture
:after: last_report
:content: facts_hash['architecture']
:uptime:
:title: Uptime
:after: architecture
:content: facts_hash['uptime']
thanks for your answer @kobena.
Its available on apt too, but you have to create the file foreman_column_view.yaml
its not created by default with .example
What I dont find is how to create linke for the content parameter. I want to link that also to the host.
What do you mean by content parameter ? Content View ? Smart Proxy ?
Here I want to have something like :
:content: link_to( facts_hash['architecture'])
so the user can click on the architecture and go to next page.
if you need a link_to, not sure you can use facts_hash.
Maybe something like this may works:
:column_view:
:architecture:
:title: Architecture
:after: last_report
:content: link_to(#{host.architecture}, "https://katello.fqdn/hosts?search=architecture+%3D+#{host.architecture}")
Just check the link to access to your architectures, it seems look like this form:
https://<katello.fqdn>/hosts?search=architecture+%3D+<archirecture>
Sorry I canāt help you more, my ruby āāknowledge ends here.
thank you so much, I edit 2 foreman files! and it works for me and did what I want.
But I have to be carefull when I update the foreman ! I have to edit them again!
Iāll check your solution too, its better if that works!
thank you again @kobena
excellent!
In addition, when I have this type of need from a client, I avoid as much as possible adding plugins nor customizing Katello as much as possible. Updates are getting more and more complicated, and Iām never sure Iām going backwards.
Now, I manage this type of need by developing a prometheus exporter and by using Katello APIs, and by making beautiful grafana dashboards. Usually, it does the job if you donāt have 10,000 hosts and thousand of metrics. If this is the case, massively multiprocessing and pagination must be used.
You are right, but in this case its for me, it makes a little bit easier, now I dont have to search in another system for the host. Now I can click that in foreman and I go directly to the next system when I click on it.
its on my To-Do-List but I dont have time for it
delighted to have been able to exchange with you
Do not hesitate to close this topic if you consider your problem solved
Hey.
Can you confirm if this plugin works with foreman 3.8 ?
I installed it successfully - I can see it in Administer/About/Plugins.
Configuration file didnāt exist in my case.
So I did what kobena suggested. I created a file in:
/etc/foreman/plugins/foreman_column_view.yaml
but it seeems this doesnāt work as I canāt see new columns.
@cps86 in foreman 3.7 I still see the new column. try only one column and check the logs too.
Hey
Actually I managed to get it work.
However, I have a problem with links. I want to display simple link in my column, e.g.:
:column_view:
:name2:
:title: test
:after: last_report
:content: link_to("something", "https://www.google.com")
I donāt have any other column in my configuration.
When I try to open the page I get:
**Oops, we're sorry but something went wrong** undefined method
link_to(āsomethingā, āhttps://www.google.comā)ā for #Host::Managed:0x000055ee65cb44c8`
Does it work for you?
Hey @cps86 sorry I forget to say that the links doesnāt work for me tooā¦ I leave it because it take to much timeā¦ you have to check the parameter options, if you can set _blank to open it in new window or so
@Neeloj I figured it out.
Edit hosts_helper.rb file which was installed with foreman_column_view plugin.
In my case it was in:
/usr/share/foreman/vendor/ruby/2.7.0/gems/foreman_column_view-0.4.0/app/helpers/foreman_column_view/hosts_helper.rb
In the fcv_content method, edit if condition as it follows:
if content =~ /(.*)\[(.*)\]/
return host.send($1)[$2.gsub(/['"]/,'')]
elsif content =~ /^link_to/
return eval(content)
else
return host.send(content)
end
Final result