Page 1 of 2
Multiple ports in one service
Posted: Tue Oct 06, 2015 6:02 am
by IvanAK
Hi all
I have problem figure out to use multiple ports status in on service. Im using check_ifoperstatus but i have 48 ports on the switch. In order to monitor all of this ports i have to create separate service like "define service {bla bla}". But I'm sure that this can be done in one Service to define all ports. But I can't figure out how.
I'v try using the command like this
"check_command check_ifoperstatus! -U $ARG1$ -A $ARG2$ -X $ARG3$ -L $ARG4$ -k 1, -k 2, -k 3"
where "-k 1" is the first port "-k 2" is the second etc. ...
But no success.
Some hints about this ?
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 6:08 am
by rhassing
What is your goal?
Check all ports, if one is down get a critical notification?
Or is it just information on the port status?
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 6:24 am
by IvanAK
Check all ports, if one is down get a critical notification?
Or is it just information on the port status?
What is the difference ?
The goal is not have big config file, more simple one line not paragraphs to scroll down etc.
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 6:39 am
by rhassing
What is the difference ?
The goal is not have big config file, more simple one line not paragraphs to scroll down etc.
The difference is that you might want to see what is going on a single port instead of the entire switch (or all ports of a switch).
If you monitor 48 ports with one service check it is one alert/notification for all 48 ports.
If than a second port goes down and the service check is acknowledged it is still critical, but acknowledged.
I don't think it makes sense to monitor 48 ports in one service check.
If you would monitor all port seperately you could check if this one port is either up or down.
When one port is down and this service check is acknowledged and the second ports goes down, it kicks of a new alert/notification.
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 7:18 am
by IvanAK
OK This is more clear now.
So I would like to monitor all ports on a switch if one port goes down send critical about that one port. So now i have config file with "define service {bla bla}" and this is for one port ( port 1 ) ( port 2 will be again new "define service {bla bla}" ) etc.
The command i have use is check_ifoperstatus! -U $_HOSTUSER$ -A $_HOSTPASS$ -X $_HOSTPASS$ -L $_HOSTAUTH$ -k 2 --- this is for port 2 and i have new define service with "k 3" etc.
In order to monitor all ports on a switch separate i have to write a tones of same code with different one parameter " the k" one. And if i have lots of Switches, you get my point. So how can i repeat the same service for all ports, because i can repeat the same service for lot of host if i put the comma (,) after host_name. So my short question is can i do this with the check_command like this:
check_ifoperstatus! -U $_HOSTUSER$ -A $_HOSTPASS$ -X $_HOSTPASS$ -L $_HOSTAUTH$ -k 1, -k 2, -k 3 Same parameters for different ports k 1 port 1; k 2 for port 2 etc.
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 7:32 am
by rhassing
everything you write is correct, except your short question.
Thats not possible to do it like that.
You need a service check for each port, but as you already say, you could use it on multiple hosts.
So if all switches are the same and they would have 48 ports, you would need 48 servicechecks to monitor all ports.
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 7:56 am
by IvanAK
Yee i thought about that when i write the last post

... but it's fine to have like costume variable macro that will reroute same service for all ports. Thanks for answers again

Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 8:01 am
by rhassing
The problem than still would be what service check is acknowledged if you want to acknowledge just one port, and how does it distinct.
You could use a service template to fill in all the same variables, but the port is different for each check.
Hope this helped for you

Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 8:18 am
by IvanAK
Yes yes solved my mistery, now i have note one problem, Service is not sorted. Service name is mess like start with port 1 then port 12 than port 5,6,7,8 than 11 and 10 etc. I don't know way ... may i open another issue or we can solve it here
Re: Multiple ports in one service
Posted: Tue Oct 06, 2015 9:20 am
by rhassing
I think it sorts it alphabetically, so it's normal to have 1,10,11,12,13,14,15,16,17,18,19,2,20,21,3,4,5,6,7,8,9 etc
I am not sure how to solve this or how to change this.
Normally i don't look to the order of the ports that are monitored. I only look at problems detected.
Maybe somebody else could help you out?