Hi,
i use opehab 2.3 on ubuntu. I want to get logviewer on port 9001 like on
openhabian. How to install the logview?
Hi,
i use opehab 2.3 on ubuntu. I want to get logviewer on port 9001 like on
openhabian. How to install the logview?
You need to install frontail
npm i frontail -g
On Ubuntu you may need to install nodejs and npm
sudo apt-get install nodejs
sudo apt-get install npm
Then let’s create a service
cd /lib/systemd/system/
sudo nano frontail.service
And here’s the script:
#!/bin/sh -
[Unit]
Description=Frontail
[Service]
ExecStart=/usr/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=pi
Group=pi
Environment=PATH=/usr/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/bin/
[Install]
WantedBy=multi-user.target
Alias=frontail.service
Change the User and Group value to your ubuntu user running OH
Save
Then
sudo chmod 644 /lib/systemd/system/frontail.service
sudo systemctl daemon-reload
sudo systemctl enable frontail.service
sudo systemctl start frontail.service
After that you can edit the ‘preset.json’ in /usr/lib/node_modules/frontail/preset/
for frontail to highlight relevant OH information
Mine looks like this:
{
"words": {
"[ERROR]": "color: red;",
"[WARN ]": "color: orange;",
"[INFO ]": "color: green;",
"Node is DEAD": "color: red;",
"GroupItemStateChangedEvent": "color: #0026FF; font-weight: bold;",
"ItemStateChangedEvent": "color: #ADD8E6;",
"ItemCommandEvent]": "color: #00137F;",
"hingStatusInfoChangedEvent": "color: #007F46;",
"ON": "color: green; font-weight: bold;",
"OFF": "color: red; font-weight: bold;",
"received command": "color: yellow;"
},
"lines": {
"/var/log/openhab2/openhab.log": "text-align: right; font-size: 1.5em; font-weight: bold; border-top: 2px solid #F8F8F8;",
"/var/log/openhab2/events.log": "text-align: right; font-size: 1.5em; font-weight: bold; border-top: 2px solid #F8F8F8;",
"ERROR": "background-color: #F3BFBF;",
"model.script": "background-color: #A6CFFD; font-weight: bold;"
}
}
Credit to @kubawolanin and @ThomDietrich
Taken from: https://github.com/openhab/openhabian/issues/28
Finally browse to http://OpenhabServerIP:9001
Good luck
hi,
thanks for help. i did the steps linke you describe.
There are some problem:
I don´t know to:
/usr/lib/node_modules/frontail/preset/
directory not existWhat does is your linux username?
Replace pi
in the service file with your linux username
Where did npm
install frontail for you?
The preset directory is in there
Hi,
first, i want to fix error to start frontail service. I have changed the user and group to openhab.
And fixed the path in frontail.service to /usr/local/bin.
But the service did not start with code 127.
I can start it with “/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log”
and the service is running.
Can you help to debug.
When you log in your ubuntu device, what is your username
Can you show me the service status?
My username is “user”.
Here is the the output:
user@ubuntu-18-openhab2:~$ systemctl status frontail
● frontail.service - Frontail
Loaded: loaded (/etc/systemd/system/frontail.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-09-26 06:28:47 UTC; 1min 47s ago
Process: 13075 ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /
Main PID: 13075 (code=exited, status=127)
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling r
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter i
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 06:28:47 ubuntu-18-openhab2 systemd[1]: Failed to start Frontail.
Can you post your .service file, please?
frontail.service file contains:
[Unit]
Description=Frontail
[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/open$
Restart=always
User=openhab
Group=openhab
Environment=PATH=/usr/local/bin/
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/
[Install]
WantedBy=multi-user.target
Alias=frontail.service
change openhab
to user
then
sudo chmod 644 /lib/systemd/system/frontail.service
sudo systemctl daemon-reload
sudo systemctl stop fronttail.service
sudo systemctl enable frontail.service
sudo systemctl start frontail.service
i changed from openhab to user, here the output:
root@ubuntu-18-openhab2:/lib/systemd/system# nano frontail.service root@ubuntu-18-openhab2:/lib/systemd/system# sudo chmod 644 /lib/systemd/system/ frontail.service
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl daemon-reload
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl stop fronttail.servi ce
Failed to stop fronttail.service: Unit fronttail.service not loaded.
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl enable frontail.serv ice
Failed to enable unit: File /etc/systemd/system/frontail.service already exists.
root@ubuntu-18-openhab2:/lib/systemd/system# sudo systemctl start frontail.servi ce
root@ubuntu-18-openhab2:/lib/systemd/system#
Look good
Does it work?
Why are you working in root?
Try to avoid that, it is quite dangerous
I switched back to user
but the service did not start:
● frontail.service - Frontail
Loaded: loaded (/etc/systemd/system/frontail.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2018-09-26 09:26:34 CEST; 8s ago
Process: 1786 ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openha
Main PID: 1786 (code=exited, status=127)
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 5.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result ‘exit-code’.
Sep 26 09:26:34 ubuntu-18-openhab2 systemd[1]: Failed to start Frontail.
Ok, try to use the code fences, please
Change the frontail.service file:
I have changes the last lines in the [Service]
section
[Unit]
Description=Frontail
[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/open$
Restart=always
User=openhab
Group=openhab
Environment=PATH=/usr/local/bin/frontail
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/frontail
[Install]
WantedBy=multi-user.target
Alias=frontail.service
i changed the file, and do reboot, but same problem.
here the service
[Unit]
Description=Frontail
[Service]
ExecStart=/usr/local/bin/frontail --ui-highlight -t dark /var/log/openhab2/openhab.log /var/log/openhab2/events.log
Restart=always
User=user
Group=user
Environment=PATH=/usr/local/bin/frontail
Environment=NODE_ENV=production
WorkingDirectory=/usr/local/bin/frontail
[Install]
WantedBy=multi-user.target
Alias=frontail.service
i use the newest ubuntu server 18.04.01 lts
Sorry. But I don’t know anymore
My set-up is exactly as your Ubuntu Server 18.04.01 lts
And apart from the directory it is the same as yours
I’ve not used fronttail, but you may get more information about the error using the command:
sudo journalctl -u fronttail.service -b
The latest attempt at startup would be at the bottom.
thanks, for the command, i find that the
Environment=PATH=/usr/local/bin/frontail
and
WorkingDirectory=/usr/local/bin/frontail
did not exist, i changed it back to:
Environment=PATH=/usr/local/bin/frontail
WorkingDirectory=/usr/local/bin/frontail
After that, the log shows a problem with the env/ node:
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Started Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 4.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Started Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 frontail[848]: /usr/bin/env: ‘node’: No such file or directory
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Main process exited, code=exited, status=127/n/a
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Service hold-off time over, scheduling restart.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Scheduled restart job, restart counter is at 5.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: Stopped Frontail.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Start request repeated too quickly.
Sep 26 13:43:09 ubuntu-18-openhab2 systemd[1]: frontail.service: Failed with result 'exit-code'.
did you install nodejs?