Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SNMP Polling with PHP

  • 01-04-2010 2:23pm
    #1
    Registered Users, Registered Users 2 Posts: 1,146 ✭✭✭


    You may have seen my previous posts about trying to get php working with snmp, now that i FINALLY figured that out with the help of wiZzard on here I have written a few scripts and have snmp data displaying on a web page.

    I want to know can i poll snmp devices with php, say every five minutes or something?

    Is this possible with php?


Comments

  • Registered Users, Registered Users 2 Posts: 6,762 ✭✭✭WizZard


    Yes you can.

    You will need to write a (php) job script and then schedule it to run however often you need using a job scheduler (*nix: cron, Windows:Task Scheduler)

    Have a look at poller.php from Cacti for some examples


  • Registered Users, Registered Users 2 Posts: 1,146 ✭✭✭mossy464


    Thanks again wizZard. Much appreciated.


  • Registered Users, Registered Users 2 Posts: 1,146 ✭✭✭mossy464


    Also, one other question. I wrote a php script to obtain various snmp data like sysUpTime etc. It returns say timeticks... etc.

    How can i take say just the time itself out of this.

    The same for sysContact. It comes back with STRING : Maurice. How can i get rid of the STRING?

    Sorry now for all the different questions im asking


  • Registered Users, Registered Users 2 Posts: 1,146 ✭✭✭mossy464


    Well I found out I can use str_replace to get rid of the STRING part in the snmp messages.

    Another question, what would be the best way to detect new devices connected to the network?

    I was thinking of writing a php script to ping a range of ip addresses every few minutes and therefore detect any new ip's but this could be pretty messy and would not be the most efficient way of doing it. Any suggestions??


Advertisement