Re: enable SMS messaging & alarm thresholds by time
Hendry Leo <[email protected]>
| Newsgroups | gmane.network.cacti.user |
|---|---|
| Message-ID | <CALLjoP2dU4OwkaC0jFJEENVqbMix7taJQTsPX5nHjjOXMF4uiA@mail.gmail.com> |
I'll see to it during my next upgrade cycle regards Leo On Mon, Sep 10, 2012 at 11:59 PM, Luca Sironi <[email protected]> wrote: > Thank you for the checkbox method suggestion, i will for sure use it. > My php is not as good as too understand a big program like cacti. > Did you ever tried to go to the step to add an sms field to the user table? > That should be even better, thus allowing different phone numbers/user > for different alarms > > regards > Luca > > 2012/9/8 Hendry Leo <[email protected]>: >> check my blog here about gammu (sms) with cacti >> http://anythingopensource.blogspot.com/ >> >> Leo >> >> On Fri, Sep 7, 2012 at 12:24 AM, Luca Sironi <[email protected]> wrote: >>> Being more precise, we are speaking about cacti+ the plugin thold. >>> >>> The plugin thold, like is today is not doing what you request. >>> Though, with a minimum of hacking around, something can be done. >>> >>> Below my personal workaround that i'm using since years >>> >>> - sending sms using whatever web tool page >>> >>> i'm adding to /plugins/thold_functions.php the following lines inside >>> the function thold_mail >>> >>> include_once($config['base_path'] . >>> '/plugins/thold/includes/sendSMS.php'); (i'm keeping my thing >>> separated) >>> sendSMS(array('12345678,'87654321','4444444'),"cacti: $subject"); >>> >>> i know, this is ugly, i'm hardcoding that for each mail sended by >>> thold, i'm passing always the same 3 phone numbers. >>> and the subject of the related alarm email to the function sendSMS. >>> Hope somebody can produce a good integration on a "per user" base tied >>> to the web gui. >>> >>> include/sendSMS.php is POSTing some parameters to my sms web page >>> (well, this will be a bit different for each of us) >>> >>> <?php >>> function sendSMS($numberArray, $messageString) { >>> $numberString = ""; >>> foreach ( $numberArray as $number ) { >>> $numberString .= $number . "\r\n"; >>> } >>> rtrim ($numberString); >>> ob_start(); // do not write to output to the page >>> $ch = curl_init(); >>> $msg = $messageString; >>> $messageString = urlencode($messageString); >>> curl_setopt($ch, CURLOPT_URL,"http://mysmsserver/sms/sendsms.php"); >>> curl_setopt($ch, CURLOPT_POST, 1); >>> curl_setopt($ch, CURLOPT_POSTFIELDS, >>> "testosms=$messageString&tn=$numberString"); >>> curl_exec ($ch); >>> curl_close ($ch); >>> ob_end_clean(); >>> $timestamp = date('dmY H:i:s'); >>> return "sendSMS $timestamp.\n\n message:\n $msg.\n\n sent to:\n >>> $numberString"; >>> } >>> ?> >>> >>> - threshold on a time base. >>> this is not a thing that i use but i do disable some specific alarms >>> during the 23 - 07 period by crontabbing some commands like this >>> >>> /usr/bin/mysql -u cactiuser -psomepassword -e "UPDATE thold_data SET >>> thold_enabled = 'off' WHERE id IN ('127','128','129') cacti >>> /usr/bin/mysql -u cactiuser -psomepassword -e "UPDATE thold_data SET >>> thold_enabled = 'on' WHERE id IN ('127','128','129') cacti >>> >>> give a look at the told_data table, while you try to do some >>> operations by gui (disable/enable alarm, change values..) >>> >>> hope it helps >>> Luca >>> >>> 2012/9/6 Avishay Cohen <[email protected]>: >>>> Hi Luca , >>>> Thanks for your quick answer . >>>> As For my first Question I want to know whether Cacti notification could >>>> send HTTP Get request with string parameter. >>>> As for my second Question, could I set Cacti Min Max Thresholds on hour >>>> basis? >>>> For example threshold low setting: >>>> A between 08:00 - 17:00 and B between 19:00 - 23:59 >>>> Thanks, >>>> Avishay >>>> >>>> -----Original Message----- >>>> From: Luca Sironi [mailto:[email protected]] >>>> Sent: Wednesday, September 05, 2012 3:58 PM >>>> To: Support requests/questions about cacti >>>> Cc: Shalom Sananes; [email protected] >>>> Subject: Re: [cacti-user] enable SMS messaging & alarm thresholds by time >>>> >>>> 2012/9/5 Avishay Cohen <[email protected]>: >>>>> Hi, >>>>> I want to enable SMS messaging in addition to e-mail messages . >>>>> Is there a plugin that allows this , for example by sending messages >>>>> to Http . >>>> >>>> Do you have an http web page with a form, tied to a sms service? >>>> >>>>> Also is there a way to set alarm thresholds by time? >>>> >>>> if you mean turning off all or some alarms for a period (an installation >>>> time), you can use the table thold_data >>>> >>>> example: >>>> >>>> #!/bin/sh >>>> if [ $# -ne 1 ]; then >>>> echo -e "\033[32m" >>>> echo -e " _ _ " >>>> echo -e " | || | _ \033[0m\033[1mUsage\033[32m:" >>>> echo -e " | || || | " >>>> echo -e " | || || | cacti_alarm.sh on/off" >>>> echo -e " \_ || | will enable/disable" >>>> echo -e " | _/ the cacti thold alarm" >>>> echo -e " | | " >>>> echo -e " |_| \n\033[0m" >>>> fi >>>> >>>> STATUS=$1 >>>> /usr/bin/mysql -u cactiuser -psomepassword -e "UPDATE thold_data SET >>>> thold_enabled = '$1'" cacti_db if [ "$STATUS" = "on" ]; then >>>> echo -e "[\033[30;42mcacti alarms enabled\033[0m]"; elif [ >>>> "$STATUS" = "off" ]; then >>>> echo -e "[\033[30;47mcacti alarms disabled\033[0m]"; >>>> >>>> fi >>>> >>>> maybe you can specify just some thresholds identifier and crontab the >>>> activation of some alarms. >>>> >>>> kr >>>> Luca >>>> -- >>>> "tempo" e "voglia" sono sinonimi nel 90% dei casi http://www.sironi.tk >>>> >>>> -------------------------------------------------------------------------- >>>> ---- >>>> Live Security Virtual Conference >>>> Exclusive live event will cover all the ways today's security and threat >>>> landscape has changed and how IT managers can respond. Discussions will >>>> include endpoint security, mobile security and the latest in malware >>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>> _______________________________________________ >>>> cacti-user mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/cacti-user >>>> >>>> ------------------------------------------------------------------------------ >>>> Live Security Virtual Conference >>>> Exclusive live event will cover all the ways today's security and >>>> threat landscape has changed and how IT managers can respond. Discussions >>>> will include endpoint security, mobile security and the latest in malware >>>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>>> _______________________________________________ >>>> cacti-user mailing list >>>> [email protected] >>>> https://lists.sourceforge.net/lists/listinfo/cacti-user >>> >>> >>> >>> -- >>> "tempo" e "voglia" sono sinonimi nel 90% dei casi >>> http://www.sironi.tk >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. Discussions >>> will include endpoint security, mobile security and the latest in malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> cacti-user mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/cacti-user >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> cacti-user mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/cacti-user > > > > -- > "tempo" e "voglia" sono sinonimi nel 90% dei casi > http://www.sironi.tk > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > cacti-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cacti-user ------------------------------------------------------------------------------ How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html