-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alert template clean up "\r\n\n" #10541
Conversation
These sql files aren't used anymore. |
Ref #10495 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fix any new installation, can a database/migration script be written to update the Template (but only IF it has the original content changed by these commits)
Can we remove the \r? It used to be needed for windows email clients I am pretty sure. |
@murrant use web ui create new alert template input two line:
then use mysqldump get sql: INSERT INTO `alert_templates` VALUES (50,'Default Alert Template','{{ $alert->title }}\nSeverity: {{ $alert->severity }}\n@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif\nTimestamp: {{ $alert->timestamp }}\nUnique-ID: {{ $alert->uid }}\nRule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif\n@if ($alert->faults) Faults:\n@foreach ($alert->faults as $key => $value)\n #{{ $key }}: {{ $value[\'string\'] }}\n@endforeach\n@endif\nAlert sent to:\n@foreach ($alert->contacts as $key => $value)\n {{ $value }} <{{ $key }}>\n@endforeach',NULL,NULL),(51,'Test CRLF','A\nB\n','',''); only see \n in |
Hi @garysteers database/migration script will affect all user, and difficult to identify data status. Only four pieces of data can be solved by copying: Default Alert Template {{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value['string'] }}
@endforeach
@endif
Alert sent to:
@foreach ($alert->contacts as $key => $value)
{{ $value }} <{{ $key }}>
@endforeach BGP Sessions. {{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value['string'] }}
Peer: {{ $value['astext'] }}
Peer IP: {{ $value['bgpPeerIdentifier'] }}
Peer AS: {{ $value['bgpPeerRemoteAs'] }}
Peer EstTime: {{ $value['bgpPeerFsmEstablishedTime'] }}
Peer State: {{ $value['bgpPeerState'] }}
@endforeach
@endif Ports {{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value['string'] }}
Port: {{ $value['ifName'] }}
Port Name: {{ $value['ifAlias'] }}
Port Status: {{ $value['message'] }}
@endforeach
@endif Temperature {{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value['string'] }}
Temperature: {{ $value['sensor_current'] }}
Previous Measurement: {{ $value['sensor_prev'] }}
@endforeach
@endif or U can clean all alert template then run seed root@ubuntu-bionic:~# cd /opt/librenms/
root@ubuntu-bionic:/opt/librenms# php artisan db:seed --class=DefaultAlertTemplateSeeder
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> yes
Database seeding completed successfully.
root@ubuntu-bionic:/opt/librenms# |
Hi @murrant Do i need to fix codeclimate issues ? |
Treat code climate errors as warnings. I think you need something like this to go with this:
|
@garysteers you can delete all existing templates (not just included ones) with |
I think this was a mistake when it was converted to the seeder only where where it wasn't inserting the line returns properly. |
This pull request has been mentioned on LibreNMS Community. There might be relevant details there: |
hello
I did TRUNCATE TABLE but when I do this comand: There are no commands defined in the "db" namespace. Do you have an idea ? Thank you |
php artisan db:seed |
This pull request has been mentioned on LibreNMS Community. There might be relevant details there: https://community.librenms.org/t/v1-56-release-changelog-september-2019/9671/1 |
DO NOT DELETE THIS TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
After you are done testing, you can remove the changes with
./scripts/github-remove
. If there are schema changes, you can ask on discord how to revert.