ESXi 5.x template - no perl SDK, pure snmp

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

Hi,
I prepared template for ESXi. It works with 5.0, 5.1 and 5.5. You can graph:
  • vhosts - number of hosts, running, installed vm client tools
    Logged in Users and number of processes
    Real Memory - on 5.1 and higher
    Processor load for every CPU core (strange works on 5.0, better on 5.1, fine on 5.5)
    HW - state of Logical volumes, FANs, … (does not make sense graphs hw with state unknown (only running(2), warninkg(3)) and make threshold)
    Disk usage
    Interface statistics
You need enable snmp (yes, ESXi include snmp), read readme.txt
Attachments
cacti_esxi_template.tar.gz
version 0.2
(102.15 KiB) Downloaded 7691 times
Screenshot - processes
Screenshot - processes
esxi_ps.png (14.96 KiB) Viewed 40301 times
Screenshot - vhosts
Screenshot - vhosts
esxi_vhosts.png (23.15 KiB) Viewed 40301 times
Screenshot - Real memory
Screenshot - Real memory
esxi_memory.png (18.69 KiB) Viewed 40301 times
Screenshot - CPU
Screenshot - CPU
esxi_cpu.png (20.98 KiB) Viewed 40301 times
Last edited by macan on Thu Apr 24, 2014 3:59 am, edited 1 time in total.
Let the Cacti grow!
bogd
Posts: 1
Joined: Wed Mar 19, 2014 11:39 am

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by bogd »

This is great -thank you!!

One small problem, though - the PHP script getting the VM info (ss_esxi_vhosts.php) is hardcoded for SNMPv3. Could someone help me get this to work with SNMPv3?

The script calls cacti_snmp_walk, and changing that to use SNMPv3 seems possible. However, I do not know enough about the inner workings of Cacti to send all required information to the script - it will need a username, password, priv_pass, etc.

Thank you!

[ Edit: there seems to be something wrong with the script (or with my ESXi server). Even after enabling SNMPv2 on the host, there is no vmwVirtMachines OID (enterprises.vmware.2) - and since the script uses it to get all info related to VMs, there's nothing there.

[root@localhost scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 7
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.1 = STRING: "vmhba0"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.2 = STRING: "vmhba1"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.3 = STRING: "vmhba2"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.4 = STRING: "vmhba32"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.5 = STRING: "vmhba33"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.6 = STRING: "vmhba34"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.7 = STRING: "vmhba35"

[root@localhost scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2 = No Such Object available on this agent at this OID

]
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

bogd wrote:This is great -thank you!!

One small problem, though - the PHP script getting the VM info (ss_esxi_vhosts.php) is hardcoded for SNMPv3. Could someone help me get this to work with SNMPv3?

The script calls cacti_snmp_walk, and changing that to use SNMPv3 seems possible. However, I do not know enough about the inner workings of Cacti to send all required information to the script - it will need a username, password, priv_pass, etc.

Thank you!

[ Edit: there seems to be something wrong with the script (or with my ESXi server). Even after enabling SNMPv2 on the host, there is no vmwVirtMachines OID (enterprises.vmware.2) - and since the script uses it to get all info related to VMs, there's nothing there.

[root@localhost scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 83818332
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 7
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.1 = STRING: "vmhba0"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.2 = STRING: "vmhba1"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.3 = STRING: "vmhba2"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.4 = STRING: "vmhba32"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.5 = STRING: "vmhba33"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.6 = STRING: "vmhba34"
SNMPv2-SMI::enterprises.6876.3.5.2.1.2.7 = STRING: "vmhba35"

[root@localhost scripts]# snmpwalk -v2c -c TestCommunity 10.1.1.1 .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2 = No Such Object available on this agent at this OID

]
SNMP v3 isn't hardcoded. I used "universal" script for all version of snmp. It will be used version, which is selected in cacti. I think, that ESXi use 1/2c only. You cannot use v3.

I haven't problem with your snmp example. I tested it on 5.1 and 5.5:
root@kaktus ~ # snmpwalk -v2c -c xxx u.v.w.x .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1331820"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "0"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "0"

root@kaktus ~ # snmpwalk -v2c -c xxx u.v.w.x .1.3.6.1.4.1.6876.2
SNMPv2-SMI::enterprises.6876.2.1.1.2.5 = STRING: "Cust1 SQL and AD"
SNMPv2-SMI::enterprises.6876.2.1.1.2.6 = STRING: "Cust1 Terminal"
SNMPv2-SMI::enterprises.6876.2.1.1.2.7 = STRING: "Cust2 SQL"
SNMPv2-SMI::enterprises.6876.2.1.1.2.8 = STRING: "Cust2 Terminal"
SNMPv2-SMI::enterprises.6876.2.1.1.2.10 = STRING: "Cust3 BSD"
Last edited by macan on Thu Mar 27, 2014 4:53 am, edited 1 time in total.
Let the Cacti grow!
alkocelj
Posts: 5
Joined: Wed Mar 26, 2014 7:59 am

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by alkocelj »

Could you please export this template that this would work on Cacti version 8.7g?
Thx

Alex
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

alkocelj wrote:Could you please export this template that this would work on Cacti version 8.7g?
Thx

Alex
You can try change template version hash. Howto is here http://docs.cacti.net/howto:determine_c ... te_version.

Please let me know, if it works. Thank you :-)
Let the Cacti grow!
alkocelj
Posts: 5
Joined: Wed Mar 26, 2014 7:59 am

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by alkocelj »

I have tried and did not work. Maybe I am doing something wrong but I cannot import it.
biohazard
Posts: 1
Joined: Tue Apr 15, 2014 6:15 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by biohazard »

The vhosts graph looks great except the running hosts measurement always shows 0. I have 5 virtual machines running, 3 with tools 2 without.

Running ESXi 5.0
graph_image.png
graph_image.png (24.92 KiB) Viewed 39913 times
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

alkocelj wrote:I have tried and did not work. Maybe I am doing something wrong but I cannot import it.
Try attached template. I reimported template only, It isn't tested on 0.8.7. If it fails, update your cacti instalation.
Attachments
cacti_host_template_esxi_5_x.xml
Template version 0.8.7g
(194.64 KiB) Downloaded 2404 times
Let the Cacti grow!
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

biohazard wrote:The vhosts graph looks great except the running hosts measurement always shows 0. I have 5 virtual machines running, 3 with tools 2 without.

Running ESXi 5.0
graph_image.png
You are right. ESXI 5.0 uses different status. I fixed it, please download version 0.2 and overwrite file ss_esxi_vhosts.php in cacti_instalation/scripts/.
Let the Cacti grow!
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by ksdjfh »

Thanks for the templates. Much appreciated.

I'm having having trouble getting data on ESXi 5.5 U1 though

I seem to ge graphing logged in users and processes just fine.

For real memory, I had to increase the timeout on the host in order to get the used memory value.

The vhosts graph is reporting 0 for everything. I changed the log level to debug in cacti and there doesn't seem to be any errors. The values returned are all zero.

For the CPU, is there any way to get the % reported by the vmware client? I don't need to know the details of every core in my host, just want to see the % that is reported by vmware.

Do you take requests for more fun stats? :) I'm not good enough at making my own or figuring out how to read MIB files
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

ksdjfh wrote: I'm having having trouble getting data on ESXi 5.5 U1 though
The vhosts graph is reporting 0 for everything. I changed the log level to debug in cacti and there doesn't seem to be any errors. The values returned are all zero.
I haven't 5.5 U1.Can you send me snmpwalk of your ESXI 5.5 U1?
ksdjfh wrote: For the CPU, is there any way to get the % reported by the vmware client? I don't need to know the details of every core in my host, just want to see the % that is reported by vmware.
I didn't find this value :-(
ksdjfh wrote: Do you take requests for more fun stats? :)
Ok, send me your requests
Let the Cacti grow!
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by ksdjfh »

macan wrote: I haven't 5.5 U1.Can you send me snmpwalk of your ESXI 5.5 U1?
Using your snmpwalk suggestion, the info in this thread and a little luck, I figured this one out myself. Like another user, when I did an snmpwalk, I got something like this:

snmpwalk -v2c -c public 10.2.100.100 .1.3.6.1.4.1.6876
SNMPv2-SMI::enterprises.6876.1.1.0 = STRING: "VMware ESXi"
SNMPv2-SMI::enterprises.6876.1.2.0 = STRING: "5.5.0"
SNMPv2-SMI::enterprises.6876.1.4.0 = STRING: "1746018"
SNMPv2-SMI::enterprises.6876.1.5.0 = STRING: "1"
SNMPv2-SMI::enterprises.6876.1.6.0 = STRING: "16"
SNMPv2-SMI::enterprises.6876.3.1.1.0 = Gauge32: 2
SNMPv2-SMI::enterprises.6876.3.2.1.0 = Gauge32: 201313300
SNMPv2-SMI::enterprises.6876.3.2.2.0 = Gauge32: 0
SNMPv2-SMI::enterprises.6876.3.2.3.0 = Gauge32: 201313300
SNMPv2-SMI::enterprises.6876.3.5.1.0 = INTEGER: 13
......

No 6876.2 which is what you're using to pull data. Originally I configured the /etc/vmware/snmp.conf file by hand which I guess ESXi didn't like.

To fix the problem I did:

esxcli system snmp set --reset
esxcli system snmp set --communities public
esxcli system snmp set --enable true

Then when I did an snmpwalk I got a lot more values and the graph started pulling data.
macan wrote: I didn't find this value :-(
I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/

I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
macan wrote: Ok, send me your requests
Does vmware expose anything from esxtop, specifically stuff from d (disk adapter) or u (disk device)? Maybe graph commands per disk adapter (I use software iSCSI so i only have one vmhba that gives me any data) or mb read/write? I tried to read the mib files and it seems like the answer might be no (I found this nagios page which seems to indicate I would have to go the api route to pull any more detailed info: http://exchange.nagios.org/directory/Pl ... pi/details
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

ksdjfh wrote: No 6876.2 which is what you're using to pull data. Originally I configured the /etc/vmware/snmp.conf file by hand which I guess ESXi didn't like.

To fix the problem I did:

esxcli system snmp set --reset
esxcli system snmp set --communities public
esxcli system snmp set --enable true

Then when I did an snmpwalk I got a lot more values and the graph started pulling data.
Interesting

ksdjfh wrote: I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/
I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
Do you know http://docs.cacti.net/plugin:aggregate?

ksdjfh wrote: Does vmware expose anything from esxtop, specifically stuff from d (disk adapter) or u (disk device)? Maybe graph commands per disk adapter (I use software iSCSI so i only have one vmhba that gives me any data) or mb read/write? I tried to read the mib files and it seems like the answer might be no (I found this nagios page which seems to indicate I would have to go the api route to pull any more detailed info: http://exchange.nagios.org/directory/Pl ... pi/details
I think, that answer is no. It isn't posibble to use SNMP for this. You have to use another way. Maybe ssh key exchange on cacti and pull data via script like:
ssh root@192.168.0.10 'uptime' | cut -d " " -f 9
0.17,
Let the Cacti grow!
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by ksdjfh »

macan wrote:
ksdjfh wrote: I think I have a workaround. Long story short, use your work to get the data, delete the graphs (but keep the data sources) and use something like this: https://bryanfullerton.com/2009/08/04/c ... e-machine/
I found that page about a year ago and used the info on it, and the page it links to in order to create the graphs I needed.
Do you know http://docs.cacti.net/plugin:aggregate?
Do you know how to do this? I've been trying to get the graph I want but I'm going in circles. I can create a basic aggregate graph and convert the area to line graphs. My problem is I would like to see an extra line on there to show the average (or maybe even hide all the individual cpus and just show a line for the average). Also in the legend, I do not want to see CPU1, CPU2, CPU3, etc. It gets very long when you have 20+ cores. Just want to see the total average of all cpus.
User avatar
macan
Cacti Guru User
Posts: 1137
Joined: Tue Mar 18, 2008 2:30 am
Location: Czech

Re: ESXi 5.x template - no perl SDK, pure snmp

Post by macan »

ksdjfh wrote: Do you know how to do this? I've been trying to get the graph I want but I'm going in circles. I can create a basic aggregate graph and convert the area to line graphs. My problem is I would like to see an extra line on there to show the average (or maybe even hide all the individual cpus and just show a line for the average). Also in the legend, I do not want to see CPU1, CPU2, CPU3, etc. It gets very long when you have 20+ cores. Just want to see the total average of all cpus.
Hi, I prepared multicpu avg tempate. There is one line line - avg load for all cores.
I created new topic for this graph template:
http://forums.cacti.net/viewtopic.php?f=12&t=52884
Attachments
Screenshot of multicpu avg
Screenshot of multicpu avg
multicpu_avg.png (22.34 KiB) Viewed 39245 times
multicpu_avg_01.tgz
Multicpu avg template
(25.02 KiB) Downloaded 1356 times
Let the Cacti grow!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests