OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: marcri on June 05, 2019, 08:31:12 pm

Title: [solved] Custom link on menu
Post by: marcri on June 05, 2019, 08:31:12 pm
Hi,

I want to add a simple link to the menu. I'm not a developer and all the tutorials i found were pretty hard for me to understand. In fact, I  want to add a link to the sarg-reports and maybe some quicklinks to the service logs.

Best
Marc
Title: Re: Custom link on menu
Post by: franco on June 05, 2019, 09:39:33 pm
Hi Marc,

Look no further ;)

https://docs.opnsense.org/development/examples/helloworld.html#plugin-to-the-menu-system


Cheers,
Franco
Title: Re: Custom link on menu
Post by: marcri on June 06, 2019, 09:46:06 pm
Thanks for your reply. It seems to be very complicated to add an entry to the menu. I need a second opnsence instance for development just to place one litte file? hmmm :-/
Title: Re: Custom link on menu
Post by: franco on June 06, 2019, 10:25:59 pm
Well, in practice you only need to create a single file on your running OPNsense to add an entry (or overwrite another).

You can also edit an existing menu file, but that will be overwritten on the next update.


Cheers,
Franco
Title: Re: Custom link on menu
Post by: marcri on June 08, 2019, 10:19:42 am
Okay, i managed to create a custom Link section onto the menu. :)
is it possible to trigger a rebuild of the menu after changing the menu.xml file?

SOLVED: /usr/local/etc/rc.configure_plugins
Title: Re: Custom link on menu
Post by: marcri on June 08, 2019, 10:32:41 am
For everyone looking to add some custom links and don't want so become a developer:

Quick and DIRTY!!

mkdir  -p /usr/local/opnsense/mvc/app/models/OPNsense/Links/Menu

vi /usr/local/opnsense/mvc/app/models/OPNsense/Links/Menu/Menu.xml
Code: [Select]
<menu>
    <Lobby>
        <Links VisibleName="Links" cssClass="fa fa-tags fa-fw">
            <Sarg url="/squid-reports/" />
            <IDS-Alerts url="/ui/ids#alerts" />
            <FW-LiveLog url="/ui/diagnostics/firewall/log" />
            <Check_MK isExternal="Y" url="https://cmk.xxxxx" />
            <Kibana isExternal="Y" url="https://logs.xxxxx" />
        </Links>
    </Lobby>
</menu>

run /usr/local/etc/rc.configure_plugins to regenerate menu