Documentation on setting up this type of alert was sparse, and not very clear. The below is an example of an alert based on a string match — basically, whenever the data from a certain module matches a string that we specify, it will fire an alert. This was originally created for LastLogin, but I updated that here to address Pandora’s lack of multiple criteria (e.g. On Change and RegEx match).
- Create a template with a regular expression criteria
- Then create an alert.
Steps to Follow:
- Go to Administration->Manage Alerts->Templates
- Create a new template and name it.
- I set the priority to Informational. I’m not sure the difference, except my guess is that it may affect the color of the alert when it fires.
- In Step 2, you can configure it like below:
- Default action is Mail to Ryan. If you don’t have that configured, see this article.
- Condition type is set to “Regular Expression” which means RegEx format. That wasn’t very clear in the documentation.
- Leave the Trigger When Matches unchecked, so that we can create basically an exclusion list of domains/hosts to not fire an alert.
- The value to set if you want multiple hosts excluded from the alert is:
- What the above says is if in the data field from LastLogin there is a match (no need for wildcards) for hostname1 OR hostname2 OR 192.168 OR …, don’t send an alert. If it’s anything else, send an alert.
- Max number of alerts sets how many times it will be fired before it stops letting you know.
- TIP: check your agents to see what they show in the data field for Last Login. I noticed that long hostnames were truncated, so instead of typing in “ryanhallman.com,” I had to put in “ryanhallman”.
- Press next to go to Advanced Fields. This is where we set the message information.
- Leave the first few fields blank (depending on how many your Mail To action uses). If you use Field1 and Mail To is set to use Field1, your text won’t be transmitted.Here’s what I have in Field 3:
Hello, this is an automated email coming from Pandora FMS This alert has been fired because the last user login is from an unknown address: Agent : _agent_ Module: _module_ Module description: _moduledescription_ Timestamp _timestamp_ Current value: _data_ Thanks for your time. Best regards Pandora FMS
- Press Finish and now we need to create an alert.
- Go back to Administration->Manage Alerts and press Create
- Fill out like below:
- Agent: Choose your agent you’d like to apply to.
- Module: Choose LastLogin since that’s what we created our template for.
- Template: Choose your template you just made.
- Action: should be able to leave it at default action for the template.
- Number of alerts to match: this can be less than what’s specified in the template, but not greater than.
- Press add alert and test to confirm.
- Everything should be done, if it’s working, you should get an email like so: