Adding Macros to service check

4 replies [Last post]
anoojwahab's picture
anoojwahab
User offline. Last seen 1 year 10 weeks ago. Offline
Opsview Sensei - 5th DanOpsview Sensei - 4th DanOpsview Sensei - 3rd DanOpsview Sensei - 2nd DanOpsview Sensei - 1st Dan
Joined: 18 Aug 2010
Posts:
Points: 1187

Hi All,

Can someone please point me to a document or list down the macros which I can use while adding service checks. I have been searching for the details on how I can add custom macros, but was not able to get the info from docs/wiki. At this point I need the macro to add the parent's IP/hostname while adding a service check argument, I believe this macro is already available but was not able to figure out. Would appreciate your help on this.

Regards,
Anooj

0
Your rating: None
awijntje's picture
awijntje
User offline. Last seen 1 day 11 hours ago. Offline
Certified Opsview AdministratorOpsview Enterprise SubscriberOpsview Sensei - 5th DanOpsview Sensei - 4th DanOpsview Sensei - 3rd DanOpsview Sensei - 2nd DanOpsview Sensei - 1st Dan
Joined: 27 Jun 2010
Posts:
Points: 9070

He anoojwahab,

sounds like you need host-attributes, but I'm not sure.

please look at http://docs.opsview.com/doku.php?id=opsview-community:attribute#name

and let me know if that's what you were looking for.

Sincerly,

Alan

Your rating: None
anoojwahab's picture
anoojwahab
User offline. Last seen 1 year 10 weeks ago. Offline
Opsview Sensei - 5th DanOpsview Sensei - 4th DanOpsview Sensei - 3rd DanOpsview Sensei - 2nd DanOpsview Sensei - 1st Dan
Joined: 18 Aug 2010
Posts:
Points: 1187

Hi Alan,

Thanks for the response. I've had a check on attributes, but that did not suite my requirement.

I have an ESX host with IP say 10.10.10.10 configured in the opsview. I now need to add say 20 VMs to opsview which is running under the ESX host 10.10.10.10. So I'll be choosing 'parent' as 10.10.10.10 while adding VMs to opsview. I need to assign a common host template while adding each VM to the opsview.

For instance, I'm adding the following service check to opsview

check_vmware_op5 -H esx -C vm --f /root/.passfile_bangdc -l runtime

Here esx is the parent of VM, so I should be able to add a service check using macro, may be something like the following for the parent's macro.

check_vmware_op5 -H $PARENTHOSTADDRESS$ -C $HOSTADDRESS$ --f /root/.passfile_bangdc -l runtime

Please let me know what macro can I can use to specify the parent IP/ Hostname.

Regards,
Anooj

Your rating: None
awijntje's picture
awijntje
User offline. Last seen 1 day 11 hours ago. Offline
Certified Opsview AdministratorOpsview Enterprise SubscriberOpsview Sensei - 5th DanOpsview Sensei - 4th DanOpsview Sensei - 3rd DanOpsview Sensei - 2nd DanOpsview Sensei - 1st Dan
Joined: 27 Jun 2010
Posts:
Points: 9070

he anooj,

Uhm I might be missing the point here, but from what you describe host-attributes should really help you...(why did they not meat your requirements).

In your case I'd do the following.

1. create a host-attributes VMPARENT.
2. change your service check to:
check_vmware_op5 -H %VMPARENT% -C $HOSTADDRESS$ --f /root/.passfile_bangdc -l runtime
3. for each VM you create (make just one and copy the others from there) add the host-attribute VMPARENT with the ip of the ESX.

But in case you really want a new MACRO, as far as I know the MACROs are hardcoded in Nagios, so you would have to change the Nagios-code to add your own MACROs.
This is why I suggested host-attributes..

Hope this helps...

I see you're using the check_esx_op5 plugin.
could you maybe share your experiences with installing/configuring/using this plugin in this topic: http://www.opsview.com/forum/opsview-community-edition/how-do-i/how-moni...

Thanks Alan

Your rating: None Average: 4 (1 vote)
anoojwahab's picture
anoojwahab
User offline. Last seen 1 year 10 weeks ago. Offline
Opsview Sensei - 5th DanOpsview Sensei - 4th DanOpsview Sensei - 3rd DanOpsview Sensei - 2nd DanOpsview Sensei - 1st Dan
Joined: 18 Aug 2010
Posts:
Points: 1187

Thanks Alan for the detailed explanation. Perhaps I'm not using the proper logic to configure attributes. Let me double check on it.

I'll update the other threads regarding my ops5 setup so far.

Regards,
Anooj

Your rating: None