Skip to main content
Question

Alerts By script : Get one line per alerts

  • 24 May 2024
  • 8 replies
  • 53 views

Hello,

 

We actually use scripts to check if elements are KO on our applications

We use Snmp and OID.

We can actually display the script result, and here the result :

 

CRITICAL: value(s):

Name Agent Status

server 1 Can't connect

server2 Can't connect

server3 Can't connect

server4 Can't connect

 

We want to display each alert line by line. 

Is centreon able to do this ?

 

Thanks all !

 

Regards

8 replies

Userlevel 2
Badge +6

Hi,

Thanks for your interest in Centreon.

I need to better undestand your request.

Are you using a custom script ? 

Do you need to be able to display this script output in Centreon, with one service per server ?

If yes, you need to adapt your custom plugin input filters, in order to be able to filter by Server (macros), in the command executed by Centreon.

You will have one service (and one status) per server.

This way is not relevant is the number of server is dynamic.

So, for dynamic servers count, you will need to have an unique service in Centreon, or to automate services provisioning (API).

 

Let me know if i understood well, and if not, please provide some screenshots of what you have/what you need.

Thanks

Badge +1

Hello,

 

actually its on the same server for centreon. The servers showed by the command are my servers that are in error.

 

I want to display each line of this list as an alert in centreon.

 

actually i have this in Centreon (i dont show serveur names for confidentiallity) :

 

I want to have in Centreon each lines as an alert

 

***232638 Cant connect : 1st alert

**********0 Cant connect : 2nd alert line

 

etc

Userlevel 2
Badge +6

Thanks for your answer.

To achieve your goal, you need to have 1 service per alert, so to filter each check with a server name.

Which command/plugin are you using ? Centreon standard of a custom one ? 

Badge +1

This is the Centreon standard.

Actually, server names are never the same in the alert, it depends of what server are in error, returned by the script.

Userlevel 2
Badge +6

Ok.

Which standard command/plugin are you using (pack / command name) ? is it https://docs.centreon.com/pp/integrations/plugin-packs/procedures/applications-protocol-snmp/ ?

If the number of server is not fixed, there is, for me, no way to have dedicated services for each server, unless you works with Centreon APIs to build a script that handle the dynamic provisioning.

That’s probably the reason why all servers are included in one check output.

Tell me if you think i misunderstood your need, and we will plan a meet to discuss live.

Badge +1

Hello,

 

thanks for your response.

I tried with an api call, so i have now this :

 

 

Do you think there is a way, with this api call and this results, to have all the “value” results as one alert line per value in centreon ?

 

Thanks again

Userlevel 5
Badge +14

I’m having difficulty understanding the need, but there may be concept problem here:

centreon work by running command that are check and return a status 

you have 1 check by “service”

you need to attache a service to a “host”

so bascally when you execute a command check you will use the “host address” to run the command and query snmp on this ip

so you always know what host you have.

 

here your check return multiple lines, ok, but what was the host queried?

 

I’m guessing you are querying a snmptable on a equipement that has the status of multiple other equipements (like a wifi controller managing multiple accesspoint for example, or a stacked switch with multiple node, or a list of docker container on a docker server;..)

 

if you have developped a script yourself, there are guidelines that explain how to format the output (basically the 1rst line is the short output that you get on the ressource status page, and any additional lines is “extended information” that you cas use to send by mail or read for resolve the incident)

 

what is impossible : have 1 alert by line in the extended informaion.

for that would need a check by each entry of your list

 

 

if the list of thing is dynamic, there will be problem to implement this, but you could create autodicovery command, (this is hardmode coding) 

if the list is  static, you can filter your script (snmp or api) and pass the name of the specific thing you want to check as a parameter. That will allow you to have 1 check by thing. (this may be easier to code in the script)

 

what could help better understanding your need : what is the technology you try to monitor, the command you are using, the oid you are using (you can obsufcate private information)

if the script is not private, you could share it so we understand better what you are trying to achieve

Userlevel 5
Badge +11

Hi @Diogo G,  

Please remember to click the “Best Answer” button for the solution that helped you resolve your issue.
Alternatively, you can share with us how you were able to solve the problem.

By doing so, you'll help someone else with the same issue in easily finding the solution.

Thank you,

Reply