Hi,
Is there any nagios plugin available which can detect if OS is running on a virtual box or physical server and revert back with some details of host machine too, in pref data.?
Any nagios plugin which can detect host is a VM/physical
-
ericssonvietnam
- Posts: 239
- Joined: Mon Jun 27, 2016 11:05 pm
Re: Any nagios plugin which can detect host is a VM/physical
Have you searched the Nagios Exchange site to see if there is a plugin that meets what you are looking for?
https://exchange.nagios.org/index.php?o ... ord=vmware
https://exchange.nagios.org/index.php?o ... ord=vmware
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
ericssonvietnam
- Posts: 239
- Joined: Mon Jun 27, 2016 11:05 pm
Re: Any nagios plugin which can detect host is a VM/physical
Already searched on exchange but no luck. In my env Vm are hosted on Hyp's. Just wanted a simple plugin which an detect it and report that OS is a Vm running of X product. (kind off)
Re: Any nagios plugin which can detect host is a VM/physical
I found a plugin that returns the operating system but not the hardware / VM it is running on.
You may have to write something to get what you want.
You may have to write something to get what you want.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
ericssonvietnam
- Posts: 239
- Joined: Mon Jun 27, 2016 11:05 pm
Re: Any nagios plugin which can detect host is a VM/physical
Thanks for the reply , i've written one simple bash steps to detect if OS is virtual or not.
Code: Select all
#!/bin/bash
SERVER_TYPE="null"
VIRT_WHAT=`which virt-what`
STAT=$?
if [ $STAT -ne 0 ] ;then
SERVER_TYPE="$SERVER_TYPE:Problem with "virtual-what" command on host"
else
SERVER_TYPE=`$VIRT_WHAT`
STAT=$?
if [ $STAT -eq 0 ] ; then
if [ -z "$SERVER_TYPE" ] ;then
SERVER_TYPE="Physical:$SERVER_TYPE '`/usr/sbin/dmidecode -t system|grep 'Manufacturer\|Product'| tr -d '\n'`'"
else
SERVER_TYPE="Virtual:$SERVER_TYPE '`/usr/sbin/dmidecode -t system|grep 'Manufacturer\|Product'|tr -d '\n'`'"
fi
fi
fi
echo "$SERVER_TYPE"
exit $STATRe: Any nagios plugin which can detect host is a VM/physical
Thanks for sharing your solution! Is it alright if we close this thread and mark the issue as resolved?
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
-
ericssonvietnam
- Posts: 239
- Joined: Mon Jun 27, 2016 11:05 pm